Nested CSS


We sometimes need to give the same class different visual. Also sometimes a certain element can have different style depending on its placement. These can be achieved by using nested CSS.

Lets clear it with a few example –

.abc{ float:left; }
.xyz .abc{ float:none;}

In the above example class abc will have float:left.
But when an element with class abc is within an element with class xyz it will not follow float:left

p{ font-weight:bold; }
.abc p{ font-weight:normal;}

In the above example the text within p tag will always be bold, unless the p tag is within an element with class abc

This entry was posted in CSS and tagged . Bookmark the permalink.

2 Responses to Nested CSS

  1. web hosting says:

    You gave me some good information about the Nested CSS. thanks keep on updating…

  2. enrique says:

    Your article(Nested CSS) is very useful to me because it is with example and little expansion ……..
    Thank you………

Leave a Reply

Your email address will not be published. Required fields are marked *