When I want to apply same attr to different class/tag I make it like this:
#wrapper .content input[type=radio], .content input[type=checkbox]{
border:none;
}
Or:
#wrapper .content input[type=radio],input[type=checkbox]{
border:none;
}
Or:
#wrapper .content .block1, .block2{
background:#FFF;
}
Is this usage wrong? Would you recommend a site or (e)book or like this for true usage of css?
By using
You are actually saying : The element with ID wrapper, having the class content and an input type of the type radio apply the following : (border:none) , for every input on the page having input type checkbox apply (border:none) .
Everything after the comma is af it starts from zero, taking no previous mentioned clauses in account.
But as Andy said, without an example of the HTML al we can do is explain how it is interpreted. (Look at the difference between block2 and .block2 .
Block2 says there is an element
<block2>and .block2 says there is an element (e.g.)<fieldset class="block2"> </fieldset>When I want to apply same attr to different class/tag I make it like this:
To answer that, if you only want to specify a class , there is no need to explicitly mention an ID. You could just as well do
.content input[type=radio],input[type=checkbox]{border:none;
}
There is no error in this, but in that case it will apply it to all elements with that class. So imagine you have 2 fieldsets, and one class .content , then to both the same css values will be applied.
So if you want to specify which fieldset, you should use the ID of the encapsulating element, followed by the class.