Formatting text with Cascading Style Sheet styles 431
An example of using styles with HTML
This section presents an example of using styles with HTML tags. You can create a style sheet
that styles some built-in tags and defines some style classes. Then, you can apply that style
sheet to a TextField object that contains HTML-formatted text.
To format HTML with a style sheet:
1. Create a new file in your preferred text or CSS editor.
2. Add the following style sheet definition to the file:
p {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 12px;
display: inline;
}
a:link {
color: #FF0000;
}
a:hover{
text-decoration: underline;
}
.headline {
color: #000000;
font-family: Arial,Helvetica,sans-serif;
font-size: 18px;
font-weight: bold;
display: block;
}
.byline {
color: #666600;
font-style: italic;
font-weight: bold;
display: inline;
}
This style sheet defines styles for two built-in HTML tags (<p> and <a>) that will be
applied to all instances of those tags. It also defines two style classes (
.headline and
.byline) that will be applied to specific paragraphs and text spans.
3. Save the file as html_styles.css.