Black Belt Coder


Quick and easy IE only CSS

Posted in development by Kris Gray on the March 28th, 2008

I remember from watching a video on the YUI Theater by Nate Koechley on the YUI CSS Foundain library and heard a sweet little trick to write CSS comments for IE only without using conditional comments.

His trick was to just append an asterisk (*) to the beginning of any command that you want to be IE only.

CSS:
  1. #Box {
  2.  
  3. min-height: 500px;
  4.  
  5. max-height: 1000px;
  6.  
  7. height: 600px;
  8.  
  9. *height: 500px;
  10.  
  11. }

Just remember to do your IE only command after the firefox command.  If you switched the two heights, IE would still read both and set its height to 600px.

One Response to 'Quick and easy IE only CSS'

Subscribe to comments with RSS or TrackBack to 'Quick and easy IE only CSS'.


  1. on July 2nd, 2008 at 4:43 pm

    [...] talked about how you can use the asterisk to indicate a rule is for IE only but while doing some investigation for another issue I discovered another easy hack that could [...]

Leave a Reply