Fri, 17 May 2024


How to set minimum width of a div for all browsers?

By: Nathalie, NetArt Media
Sat, 13 February 2021

The example below will set the minimum width of the "example-div" element to 200px. It works in all major browsers (Internet Explorer, FireFox, Chrome, Safari etc.).

<style>

.example-div
{
min-width:200px;
width:auto !important;
width:200px;
}

</style>

<div class="example-div"></div>

A similar css code can be used also to set a minimum height of a div, just width should be replaced with height then -

min-height:200px;
height:auto !important;
height:200px;


Category: CSS
Share this post:



See All Scripts






Subscribe for our newsletter

Receive the latest blog posts direct in your mailbox