Browser bugs and CSS hacks…

January 21
A

ll web designers suffer from browser bugs. Once you finished your website and prepare it to publish, you should again walk a long trip to make your website compatible in all browsers or at least in the most common browsers.

 

There are many methods to fix browser bugs, like conditional comments, using java script, CSS hacks ect…
today I will talk about CSS hacks. CSS hacks is one of the many ways to deal with browser bugs. I use it myself and find it great.

 

Most CSS hacks deal with selectors. So this is a list of browsers version and the selectors that deal with them:


IE 6 and below

* html {}

IE 7 and below

*:first-child+html {} * html {}

IE 7 only

*:first-child+html {}

IE 7 and modern browsers only

html>body {}

Modern browsers only (not IE 7)

html>/**/body {}

Recent Opera versions 9 and below

html:first-child {}

Note that these hacks rely on browser bugs or missing features. that means result may vary in some lesser-known or future browsers.

 

Now with these selectors you can edit your CSS file to make it fit to the most common browsers. Just write the selector of specific browser version, add the element name and edit its property as it should be in that browser. For example, positioning hack in internet explorer 6. if we have an element with specific height and width but of course in internet explorer 6 you will find it upper or lower than the desired position. To fix this bug, simply write its selector (*html), the element name and set a margin-top, the value differs from browser to another. In internet explorer 6, I suggest  to set random values even in minus coz internet explorer 6 doesn’t make any sense at all. See the following ex:


#button  {

width: 100px;

height: 50p;

background: url(images/button.png) no-repeat;

left: 95px;

}

*html #button  {

margin-top:-5px;

}

You can put these lines in the same style sheet you use or you can put it in a new style sheet just for internet explorer hacks and transfer your browser to it by using a conditional comments.

Next time I will talk about png fix in ie 6. hope you enjoyed my post.


StumbleUpon.com Add us to your digg favorites Add us to your delicious favorites add us to your facebook favorites follow us on twitter Add us to your technorati favorites Add us to your wordpress favorites Add us to your reddit favorites Add us to livejournal favorites

42 Responses to “Browser bugs and CSS hacks…”

  1. I think your blog need a new wordpress template. Downalod it from http://templates.wordpressguru.in, The site has nice and unique wordpress templates.

  2. hay…i do my own theme myself, and i really love my theme. sorry if you didn’t like it.

  3. Hello. Great job. I did not expect this on a Wednesday. This is a great story. Thanks!

  4. I think your blog need a new wordpress template. Downalod it from http://templates.wordpressguru.in, The site has nice and unique wordpress templates.

  5. Great articles & Nice a site!!

  6. Wow! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?

  7. that’s ok maplestory mesos. but please make sure to add a link to the original site (my blog). glad you liked it.

  8. As a Newbie, I am always searching online for articles that can help me. Thank you

  9. ohh ice post but really?/? :P

  10. Wow! what an idea ! What a concept ! Beautiful .. Amazing ?I usually don’t post in Blogs but your blog forced me to, amazing work.. beautiful ? Please, can you PM me and tell me few more thinks about this, I am really fan of your blog…

  11. thank you maplestory, am always ready to help. if you have any question feel free to contact me from the CONTACY ME in sidebar. i checked your site it is a beautiful site too, good work.

  12. Such a usefule blog wow !!!!

  13. googd thanks a lot,this is very useful!!

  14. Hey very nice blog!!

  15. Great articles & Nice a site!!

  16. Thank you for your help!

  17. thanks !! very helpful post!

  18. Good! Thank you! I always wanted to write in my site something like that. Can I take part of your post to my blog?

  19. hi ffxiv, thank you for visiting my blog and glade to find my posts useful, about coping from my blog, that’s ok as long as you point back to the original post.

  20. you know your stuff, thanks alot, great read.

  21. There is obviously a lot to know about this.

  22. Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader

  23. Great articles & Nice a site!!

  24. Of course, what a great site and informative posts, I will add backlink – bookmark this site? Regards, Reader

  25. You post great articles. Bookmarked !

  26. Interesting, I didn’t know that. This was very helpful information. You should check out my site! http://www.iloveinternetmarketingonline.com , Thanks.

  27. Really nice post here – I don’t know why you don’t just get the most out of these tools whilst they are free.

  28. I truly appreciate you taking the time to post this. I really liked reading it and am looking forward to more posts from you! Keep ‘em coming.

  29. Demonstrate the spirit of free style…

    My site is about the freestyle culture website, welcome to interested friends to visit!…

  30. The most followers Digg…

    Hope that we’d come see! Under the respective exchange ideas! Freedom to share!…

  31. i would love to…thank you for visiting my site..

  32. i will visit your site…and check it out…

  33. Thank you for your article,It’s well written, in depth posts like these that have aided me in becoming a good forex trader.

  34. Thank you for your article,It’s well written, in depth posts like these that have aided me in becoming a good forex trader.

  35. JUST AWESOME!!!!!!Gr888 Job…

  36. Maybe you should make changes to the post name title Browser bugs and CSS hacks… | meinterest to more catching for your content you write. I liked the blog post however.

  37. thanks for the advice i will try to fix it. keep on visiting my site.

  38. I just sent this post to a bunch of my friends as I agree with most of what you’re saying here and the way you’ve presented it is awesome.

  39. You certainly have some agreeable opinions and views. Your blog provides a fresh look at the subject.

  40. Thanks For This Blog, was added to my bookmarks.

  41. you might have an ideal blog here! would you wish to make some invite posts on my blog?

  42. glade you liked it, please pm me for more details…

Leave a Reply