Hi......
I want to use class in CSS , please tell me how to use class in CSS ? Please explain with an example ? I want to also know difference between class and div in CSS ?
Thanks............
Class in CSS
1 Answer
Know the answer? Post it. Somebody with the same question will find it here.


Shen Hengbin94 reputationPosted Feb 24, 2012, 10:34 PM EST
then you can define it in your css file like below .
div .classname{
text-align:center;
background-color:#ffc;
font-weight:bold;
}
2, >> I want to also know difference between class and div in CSS ?
I don't know what's your mean. I guess you want to understand the difference between
div .classname and .classname and .classname div ?
div .classname : refers to all divs with the class 'classname'
.classname div : refers to all divs that are children of the element with the class 'classname'
.classname : refers to all elements with the class 'classname'