May 7, 2008
@ 12:11 PM

So as you can see I've been playing with ASP.NET MVC in my free time lately. But as it turns out I learned something totally unrelated to MVC while I was editing the default stylesheet that MVC Preview 2 ships with.

#mainContent
{
    padding: 30px 30px 15px 30px;
    background-color: #FFF;
    border-bottom: 3px groove #4b6f92;
    margin-bottom: 30px;
    _height: 1px; /* only IE6 applies CSS properties starting with an underscrore */
}

I can't believe I never knew about this. I have read 3 CSS books in the past few years and don't recall ever reading about this hack. So while it isn't the end-all solution to fixing CSS bugs in IE6, I think it should come in pretty handy in the future now that I know it exists.

I found this URL to WellStyled which describes the hack in more detail. Here are some cool usage examples of this hack:

#box 
{ 
    min-height: 300px; 
    height: auto; 
    _height: 300px; 
}
#menu 
{ 
    position: fixed; 
    _position: absolute; 
}
Categories: CSS | Web Standards kick it on DotNetKicks.com

Wednesday, May 07, 2008 11:34:59 AM (Central Standard Time, UTC-06:00)
The underscore hack, imo, should be used only for testing purposes, if you validate your CSS with the underscore hack it will consider the underscore invalid, a more effective way would be to use the star hack and just use a conditional comment for IE6. http://24ways.org/2005/avoiding-css-hacks-for-internet-explorer you can see a list here

Trevor
Thursday, May 15, 2008 8:19:47 AM (Central Standard Time, UTC-06:00)
That's naughty in my opinion. If you rely on a bug for a commercial website you may end up with pages acting strangely when a new browser version is released.

Microsoft provides a way to target the IE6 browser with conditional comments.
Name
E-mail
(will show your gravatar icon)
Home page

Comment (Some html is allowed: a@href@title, strike) where the @ means "attribute." For example, you can use <a href="" title=""> or <blockquote cite="Scott">.  

Enter the code shown (prevents robots):

Live Comment Preview