View Single Post
Old 03-23-2013, 04:10 AM   #13
Jellby
frumious Bandersnatch
Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.Jellby ought to be getting tired of karma fortunes by now.
 
Jellby's Avatar
 
Posts: 7,543
Karma: 19001583
Join Date: Jan 2008
Location: Spaniard in Sweden
Device: Cybook Orizon, Kobo Aura
Quote:
Originally Posted by Turtle91 View Post
cool!

That kind of goes against my program-oriented background - being able to define a reserved tag as a user class (the difference between b and dot b). It certainly makes CSS more flexible. Although if I started doing that (using b and .b at the same time) I would probably confuse myself even more than I already do!!
Well, it's not exactly a reserved tag, it's just a tag with some intended semantics and some default style. Also, different renderers will probably have different default styles (a text-based browser could draw it with inverted background and foreground colours, a text-to-speech system could apply some voice inflection).

Maybe <b> is not the best example, but take <em>. It's intended to mean emphasis and, although its default style is often italic, you could want to have some other style in a given document (bold, underlined, red, different font, letterspaced...). So, not only you can override default styles, but it's sometimes a good idea to re-define them, when it is important. For instance, I often use:

Code:
em { font-style: italic; }
em em { font-style: normal; }
so I make sure that <em> is italic and <em> inside <em> is not.

And you can even make a <div> behave as a <span> (display: inline) and vice-versa (display: block). But there are some XHTML restrictions that still apply (a <span> or a <p> cannot contain a <div>, for instance). Since <p> cannot contain <div>, I sometimes create a special class of <span> that behaves as <div>, and then <p> can contain this <span>
Jellby is offline   Reply With Quote