How to use two CSS classes togather for single paragraph or div

Usually attributes are assigned just one value, but this doesn't mean that that's all you're allowed for the class attribute. In reality, you can assign as many classes as you like! For example:

<p class="class1 class2 class3">...</p>

<div class="class1 class2 class3">...</div>

Using these three classes together (separated by a space, not with a comma) means that the paragraph or div calls up the rules assigned to class1 class2 and class3. If any rules overlap between the two classes then the class which is below the other in the CSS document will take precedence.

No comments:

Post a Comment