• Home
  • About Me
  • My Native
  • Blog
  • Photos
    • World Through My Lens
    • Owner of the Earth
    • Concepts
    • Stars From Heaven
    • Divine Touch
  • Sitemap



W3C Validated CSS with IE Hacks

 Posted on June 26, 2009      by Suresh Kumar
 2

Whenever there is a problem in validation because of IE hacks. Now here is the way to overcome the error to pass the validation.

The general fix for IE 6 is “_ ” followed by a property and value

Example (_margin: 5px; )

For IE 7 “*” followed by a property and value

Example (*margin: 5px ; )

But this will not get passed in W3C validation service.

Instead of setting property like this

h2 {*margin: 10px ;}

For IE 6 and below

* html h2 {margin: 10px ;}

IE 7 and below

*:first-child+html h2 {margin: 10px ;}

* html {margin: 10px ;}

IE 7 only

*:first-child+html h2 {margin: 10px ;}

Let assume a CSS like this. If

p

{

padding: 5px;

}

*:first-child+html p

{

padding:10px;

}

* html p {

padding:10px;

}

Try the above CSS and check.

IE7 and IE6 paragraph padding will be 10px and all other browsers except IE Paragraph padding will be 5px;

Hey developers, now cross browsers issues can be solved with a proper standard W3C validation…

This will help out to style your website with proper web standards… Happy Styling :)

2 Comments for W3C Validated CSS with IE Hacks

rohit

hay very usefull tips……….

Reply

RSRSuresh

Hi Buddy,

Nice & very useful tips….. expecting more tips about CSS from you..

Reply



Leave a Reply





  Cancel Reply

  • Popular Posts

    • MTC vs Vodafone
      I feel there is some relationship between Vodafone Zoo Zoo and MTC logo. I guess...
    • Bye Bye Year 2009
      Life is going very speed now a day. It's seems just I passed the 2009 New Year. Now the day has come...
    • Life is beautiful
      This is not about the review of the movie "Life is beautiful". My opinion about life. When...
  • Archives



© www.sureshonline.com.,All Rights Reserved.