Using double classes to your advantage
Have you ever made up a single class just for one instance of something in an html page? Well, did you know you can set a double class?
According to the heirarchy of CSS and inheritance of properties, the second listed class always takes precedence. Add a space between the two classes.
<Td class=”blue redletters”>
Here are the properties for each of these declarations
.blue{
color:#666;
font-size:12px;
}
.redletters{
color:#777;
}
The last use of the color property, in this instance, for redletters, is the one that takes precedence. This gets around the silly usage of some <span> tags just for a single class.
Here are some similar arcade posts
- How do I make Super or Subscript letters and numbers using HTML?
- How do I reduce the size of my CSS file? Can you teach me some “shorthand” tricks?
- Which should I use, relative or absolute positioning?
- Style sheet precedence in table cells and stylesheets
- Formatting Ordered lists so they look like an outline in Microsoft Word.
If you enjoyed this post, please consider to leave a comment or subscribe to the feed and get future articles delivered to your feed reader.











Comments
No comments yet.
Leave a comment