"Personal thoughts, ramblings, and nonsense from Drew, himself."
This post was written on June 19, 2006 at, or around 3:33 am by Drew. This post is composed of 387 words from the English language and currently has 3 comments to its name. Additionally, this article is tagged under CSS, Hacks, XHTML and you can trackback to this article using this link. This post was last updated on Sep 18, 2008. Enough talk, carry on.
As I have been designing small-based, bear-minimum CSS design layouts I have just coded and been done with it. The past six months have been a learning experience and have come to love CSS for what it’s worth. Sometimes, though, designing gets hedious and I have to use hacks; for today, we aim one at Internet Explorer. Please note: This is yet another older piece of writing of mine. As it still probably holds value, I do try to stay away from CSS hacks, but sometimes, they really do come in handy.
There is one hack that I seem to come across more than I really should, but apparently it is one of the most important hacks of today, or should I say, of Internet Explorer? When designing the new layout for Dev-News, I had to use this once. What happened was, Internet Explorer wasn’t spacing bulleted items like ALL the other broswers were; even Opera.
To send different CSS rules to Internet Explorer, I had to use the child selector command, in which Internet Explorer can’t understand (figures). The child selector command involves two elements, one is the parent, and the other the child to the parent. So, the following refers to the child, body, contained within the parent, html:
CSS
html>body
Now let’s take a practical example from Dev-News (now, non-existant website):
CSS
#info ul li a {
display:block;
width:175px;
background:url('path_to_image.gif') no-repeat left top;
padding:0px 0 0 15px;
margin-top:-5px;
color:#fff;
}
html>body #info li a { margin-top:2px; }
Internet Explorer can’t understand the second CSS rule, due to the hack, so it will ignore it and use the first rule and all other browsers will use the second rule. This has really helped me out with designing a layout. I used to pull my hair out and just let it be. Now that I design compliant websites, I have no room for anything less than perfect – so to speak.
Enjoy, and have fun with your CSS.
We’re redesigning our web site from flash based to pure xhtml, css and dom. As you had done before, I was pulling my hair out trying to find a way around some silly IE bugs. Our site still isn’t up, but it should be soon. Thanks for the tip.
Thanks so much for this! I had another solution for some of my IE bugs, but this one is much cleaner. Works great!
Thanks so much for this! I had another solution for some of my IE bugs, but this one is much cleaner. Works great!
No problem. Thanks for the comments!
Note: If this is your first time commenting on my site, there will be a delay, as I have to approve your comment.
Ajax AOL/AIM Apache Applications Architecture Career Case Projects CentOS CSS Debian Design File Systems Google Hacks Hardware Humor JavaScript Life Management Movies Networking Open-Standards Personal PHP Programming Registry Samba Security Shell Scripting Software Sys Admin Tech The Notebook Tips UNIX/Linux Virtualization VMWare VPC (MS Virtual PC) Walkthrough Web Apps Windows Work Workaround XHTML XHTML 2.0