![]() ![]() |
Text Decoration With CSSYou've probably decorated your home during the holidays, or perhaps for some major party (Senior Prom, anyone?), and so you know what a major pain such projects can be. Unwrapping trinkets, stringing lights or crepe paper, cleaning... it's enough to keep you from ever doing it again. Fortunately, decorating text isn't nearly as stressful. In fact, it's really quite easy, and can be more useful than a handful of cheap paper confetti. Come to think of it, so are most things, but never mind that now. Let's look at how we can decorate text, and ways to use that in Web page design. Decoration Station
The property in question is
The first kind of decoration to be examined is
Previous to CSS1, the only way to accomplish underlining was to use the underline tag ( So let's say that we have a paper in which we want all level-4 headings to be underlined. The declaration is straightforward enough: H4 {text-decoration: underline;}
This is another H4And there you have it-- underlined level-4 headings! There is a counterpart to underlining, and that's over lining. In this case, a line is drawn above the text, instead of below it. Why was this included in the specification? Well, that's a good question, and I don't really have an answer, but you can do it. For example: H4 {text-decoration: overlie;}
This is an H4Okay, so maybe it isn't the most common typographical effect ever, but it can be somewhat interesting. You might use it in a fashion similar to horizontal rules, as sort of a between-sections break. Even more interesting, you could use it in combination with underlining, like this: H4 {text-decoration: underline overlie;}
This is yet another H4
This demonstrates one of the biggest points about
Speaking of which, we should look at the other two values of Blink and You Might Strike Out
Navigator fans rejoice: the most famous Netscape-invented tag ever has made its way into the CSS1 specification. That's right, one of the values of Therefore, only CSS1-aware versions of Netscape Navigator are going to see the following effect: H4 {text-decoration: blink;}
This might be a blinkin' H4Lovely, isn't it?
All right, this brings us up to the final value of H4 {text-decoration: line-through;}
This is a stricken H4Legislators use this to show where laws have been modified, printing the replaced portions of the law with a strikethrough line such as you see above. Most of you probably won't need to use this effect, except maybe when writing humorous pieces. Using Decorations in Page DesignAs we've already seen, you can use underlining to add emphasis to things like certain heading levels. You might also decide that emphasized text should be underlined, in addition to whatever other effects it has it a given browser. So you could try this: EM {text-decoration: underline;}
The above rule will give the
Another way to employ A {text-decoration: none;}
The above rule will have the effect of turning off link underlining in CSS1-aware browsers. Conversely, declaring the value Conclusion
As we've seen, |
|
Go Back |