Click here to Skip to main content
15,889,335 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I have a basic CSS question. I would like to know the difference between these two blocks of classes. What's the difference between
fieldset.login label and fieldset label.login in the example below ?

CSS
fieldset.login label
{
    display: block;
}

fieldset label.login
{
    display: inline;
}
Posted
Comments
Sunasara Imdadhusen 14-Feb-11 8:09am    
Good question!!

The first is generic, the second specific. For the first a fieldset class called login is applied to all labels within the fieldset whereas in the second only labels with a class of login within the fieldset will have the class applied. Fairly sure that's it.
 
Share this answer
 
The difference is:

this assigns display:block; to all labels contained within fieldsets with class "login"

fieldset.login label
{
    display: block;
}


whereas this assigns display:inline; to all labels with class "login" contained within all fieldsets

fieldset label.login
{
    display: inline;
}
 
Share this answer
 
Hi

The above explanations are correct. Try this visual example as well to understand clear.

the CSS..

C#
fieldset.login label
{
    color:Blue;
}
fieldset label.login
{
    color:Green;
}


the HTML...

XML
<fieldset>
   <label class="login">It is login class on the label</label>
 </fieldset>
     <fieldset class="login">
            <label >It is login class in the FieldSet</label>
 </fieldset>


This example is self explainable
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900