HTML and CSS Reference
In-Depth Information
.
Output
FIGURE 7.14
Various text
alignments avail-
able using CSS.
You can also include the align attribute in the <p> tag. It's most common to use the
justify setting for the align attribute with the <p> and <div> tags. When you justify
a paragraph, the text is spaced so that it's flush with both the left and right margins of
the page.
Fonts and Font Sizes
Earlier in this lesson, I described a few font-related properties that you can manipulate
using CSS. In fact, you can use CSS to control all font usage on the page. I also
described how the font-family property can be used to specify that text should be ren-
dered in a font belonging to a particular general category, such as monospace or serif.
You can also use the font-family property to specify a specific font.
You can provide a single font or a list of fonts, and the browser will search for each of
the fonts until it finds one on your system that appears in the list. You can also include a
generic font family in the list of fonts if you like, just as you can with the <font> tag.
Here are some examples:
<p style=”font-family: Verdana, Trebuchet, Arial, sans-serif”>
This is sans-serif text. </p>
<p style=”font-family: Courier New, monospace”> This is
monospace text. </p>
<p style=”font-family: Georgia”> This text will appear in the
Georgia font, or, if that font is not installed, the browser's
default font. </p>
You can also use CSS to specify font size. Unfortunately, although the approach for
specifying the font face itself is the same whether you're using the <font> tag or CSS,
specifying font sizes under CSS is much more complicated than it is with the <font> tag.
The trade-off is that with this complexity comes a great degree more flexibility in how
font sizes can be specified. Let's start with the basics. To change the font size for some
text, the font-size property is used. The value is a size (relative or absolute) in any of
the units of measure supported by CSS.
7
 
 
Search WWH ::




Custom Search