10.07.2017 Views

246996016-HTML5-Step-by-Step

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

108 Chapter 7<br />

Note There is not a big difference between xx-small and x-small, especially in Internet<br />

Explorer 9.<br />

You can define a font size for an entire tag in the style sheet like this:<br />

p {font-size: 12px}<br />

Or, embed it in a single paragraph’s tag like this:<br />

This text is extra-small.<br />

You can also specify relative sizing as a percentage of the base size, such as 120%.<br />

Another way to specify relative sizing is in ems. An em is a multiplier of the base font;<br />

for example, 2 em is two times the base size, or 200%.<br />

For example, you could make text tagged as twice the size of the base font <strong>by</strong><br />

including this in the style sheet, as shown in the following:<br />

h1 {font-size: 2em}<br />

Or, you could set the size for an individual heading, like this:<br />

This text is twice the base size.<br />

To specify a font color, use the color attribute that you learned in previous chapters.<br />

For example, to make text in all tags blue, place this style rule in the style sheet, as<br />

shown this example:<br />

p {color: blue}<br />

To include the color attribute for a single tag, include it in the style attribute like this:<br />

This is blue text.<br />

You can use the basic or extended color names, as described in Chapter 4, “Using Lists and<br />

Backgrounds,” or use hexadecimal or RGB naming. Refer to the colors.htm, extended.htm,<br />

and websafe.htm files in the Reference folder of the downloadable companion content<br />

for full-color swatches of these groups of colors.<br />

Remember from Chapter 4 that the color attribute refers to the foreground color, or the<br />

color of the text. You can also set a background color for the text. This is different from

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!