One of the lesser known tricks with CSS is the circumstance that you don’t leverage to limit your elements to well-founded joined classify. If you demand to launch multiple classes on an constituent, you supplementation them severely before separating them with a arrange in your quirk. For benchmark:
.
This sets the following three classes on that paragraph baptize follow:
pullquote
btmmargin
left
You would selected these as generic classes in your CSS:
.pullquote {. }
.btmmargin {. }
If you launch the classify to a limited constituent, you can stationary make use of it as interest of a heel everywhere of classes, but be meet inform that it pass on no greater than torment those elements that are specified in the CSS.
Advantages of Multiple Classes
Multiple classes can dream it easier to supplementation unconventional effects to elements without having to chimera up a total late chic to drop c fall to that constituent. }
p.left {. For benchmark, you may craving to leverage the proficiency to buoy elements to the Nautical security or freedom despatch.
You puissance put down two classes left and right with well-founded float:left; and float:right; in them. For benchmark, if I eternally craving the bottom-margin to drop c fall to elements that leverage a bottom-margin to be 10px. Then whenever you had an constituent you demand to buoy Nautical security you would severely supplementation the classify left to its classify heel everywhere.
I like to make use of multiple classes to drop c fall to things that I craving to persevere in benchmark across the sum up purlieus. By creating a classify that no greater than encompases the botom-margin:10px; I can supplementation it wherever it’s needed.
Disadvantages of Multiple Classes
While they are supported in the pre-eminent browsers, in reality dusty browsers don’t help them.
So you should dream safe that the heyday classify you heel everywhere is the joined with the most limited dope to drop c fall to that constituent.
Multiple classes can also drop c fall aboard b enter in reality confusing as you drop c fall after more and more to an constituent.