CSS_herald

Alternative IE-Only CSS Hack (or the CSS Reset?)

As we all know, there are many ways to get CSS in Internet Explorer to play ball, i know its not easy at times and it can be half the job of a web developer to get CSS working correctly in all browsers.

For the purists, look away now - for here is a dirty, low down css hack!

Basically, comments in CSS are handled differently, we all know that - i’ve found yet another (easier) way to hack IE that no-one else has noticed (?)

Here’s an example, this is a table that i’m styling, but the header doesn’t want to play ball in IE, so look at the line in the middle of the code:


.list th[scope=col] {
background: url(images/tablerowcol.png) repeat-x #F8F8F8;
color:#FFF;
//line-height:19px;
border-bottom: 1px solid #faa;
padding-bottom:0px;
}

Notice the // commented out line? It gets ignored on all browsers apart from every version of Internet Explorer. It does cause a warning to be shown in Mozilla Firefox if you have the web developer’s toolbar installed, but its non-intrusive and nothing pops up to say its an error.

Of course, this isn’t the purest method of getting cross-browser css compatibility, the ubiquitous CSS Reset is another way to get easier cross-browser satisfaction, with Yahoo and Google providing their own versions of the original hack by Eric Meyer.

Share This

« CSSGlobe Pure CSS Data Chart
» Apple iTunes Menu In CSS

One Comment, Comment or Trackback

  1. That’s basically the same as the underscore hack. All characters that are parsed by IE lte 6 can be seen over at the Internet Explorer extended underscore hack-article ;)

Reply to “Alternative IE-Only CSS Hack (or the CSS Reset?)”


Google_reader