The CSS style min-height is not supported correctly by Microsoft Internet Explorer 6.0 and earlier versions. This is another reason (in addition to hundreds of reasons!) to switch to a newer web browser like Opera or Mozilla Firefox.
So, How could you -a web developer- fix this behavior and make Microsoft Internet Explorer 6.0 correctly show a minimum height for an element in your web page, just with a small CSS code, without many nested and so long elements?
Actually, There are a few solution to (hack) Microsoft Internet Explorer 6.0 and make it display a (min-height) for an element in your page.
You can find a very long solution here [http://www.greywyvern.com/code/min-height-hack]! I prefer you don't read it! The following solution in this article is the easiest one!
Simply, You can use this piece of code to give any element a minimum height (ie: min-height). This is valid for any element in your web page:
selector {
min-height: 500px;
height: auto!important;
height: 500px;
}
The first line and second line: will affect all modern browsers and make the min-height equals to 500 pixels (for example, of course you can change it to any value). and make the height is auto (to fit the content). This auto value is (important). That means it will not be changed with the third line.
Microsoft Internet Explorer 6.0, Will ignore the first line and the second line, and will only apply the third line. If the content of the element needs more than 500 pixels (again, this value for example, of course you can change it to any value you want), it will increase the height of the element to fit all the content inside it!
Assuming Microsoft Internet Explorer 6.0 will not fix the correct implementation for the!important declaration and assuming that if IE7 does, they'll also implement min-height correctly.
The above snippet of CSS works properly in Microsoft Internet Explorer 6.0, Firefox and any Mozille or Gecko web browser, Opera browser 7.x+, Safari browser1.2
This is the fastest and easiest solution for this problem!
Many thanks to Dustin Diaz for sharing!
So, How could you -a web developer- fix this behavior and make Microsoft Internet Explorer 6.0 correctly show a minimum height for an element in your web page, just with a small CSS code, without many nested and so long elements?
Actually, There are a few solution to (hack) Microsoft Internet Explorer 6.0 and make it display a (min-height) for an element in your page.
You can find a very long solution here [http://www.greywyvern.com/code/min-height-hack]! I prefer you don't read it! The following solution in this article is the easiest one!
Simply, You can use this piece of code to give any element a minimum height (ie: min-height). This is valid for any element in your web page:
selector {
min-height: 500px;
height: auto!important;
height: 500px;
}
The first line and second line: will affect all modern browsers and make the min-height equals to 500 pixels (for example, of course you can change it to any value). and make the height is auto (to fit the content). This auto value is (important). That means it will not be changed with the third line.
Microsoft Internet Explorer 6.0, Will ignore the first line and the second line, and will only apply the third line. If the content of the element needs more than 500 pixels (again, this value for example, of course you can change it to any value you want), it will increase the height of the element to fit all the content inside it!
Assuming Microsoft Internet Explorer 6.0 will not fix the correct implementation for the!important declaration and assuming that if IE7 does, they'll also implement min-height correctly.
The above snippet of CSS works properly in Microsoft Internet Explorer 6.0, Firefox and any Mozille or Gecko web browser, Opera browser 7.x+, Safari browser1.2
This is the fastest and easiest solution for this problem!
Many thanks to Dustin Diaz for sharing!
SHARE