Interesting css3 selectors nth-child, :target

5 11 2009

When I am reading the css documentation in W3c site. I met with some of the interesting selectors like nth-child and :target.

With the nth-child selector we can add different css for the even and odd elements. For example in a table we want to display different background color for the alternate rows. This we can do simply with the css. I used to write in the code to add odd class for the odd row, even class for even row using if conditions. This is really cool. We can see example at http://www.w3.org/Style/Examples/007/evenodd.

With the :target selector we can create a tabs view without using any javascript code. We can see an example at http://www.w3.org/Style/Examples/007/target

Unfortunately these selectors does not work with IE.  I was very happy by seeing these selectors but it IE disappointed me a lot.  Just because of IE  I need to write code to add different classes for the even and odd rows.  I tested with IE8 also but no luck, might need to wait till next release of IE. Just because of IE I can’t use these selectors.

 

Advertisements

Actions

Information

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s




%d bloggers like this: