Here is a tip on how to use css on web pages.
As you develop your website you define your css-file and often uses its classes explicitly on the web page. Sometimes there is a need to use behaviour from different classes and you end up with creating a new redundant one for a particular situation.
Here is how you can do to use existing classes by cascading them for extended behaviour for an element on a web page when explicitly declaring them .
The css-structure looks like this:
.ce1 { color:#FF0000; font-size: 16px } .ce2 { color:#0000FF; } |
The common way to explicitly use a css-class in an element is like this, i.e. refer to one css-class element:
| <div class="ce1">Some text</div> |
To use more than one classes do it like this:
| <div class="ce1 ce2">Some text</div> |
and it will render this way:
Some text
It doesn't matter which order the css-elements has in the div class argument - i.e. class="c1 c2" is the same as class="c2 c1".
This way you get the properties of both classes. If the same properties are specified in both classes , the precedence lies in which order the css-classes are declared in the css-structure. Should be the opposite in my opinion.
So if you declare the css-structure like this:
.ce4 { color:#0000FF; } .ce3 { color:#FF0000; font-size: 16px }
|
the same code :
| <div class="ce3 ce4">Some text</div> |
will render this way:
Some text