Using Font Styles: Font, Font Size, Font Weight, Font Style


Using Font Styles: Font, Font Size , Font Weight, Font Style

Here are some of the properties you can use with fonts:

  • font-family specifies a font, such as Arial or Helvetica. You can list alternative fonts in case the host computer doesn't support your first choice. To do that, specify font names as a comma-separated list, like this: {font-family: Arial, Helvetica} .

  • font-style indicates whether the text is to display using a normal, italic, or oblique face.

  • font-variant indicates whether the text is to display using the normal letters for lowercase characters or using small capitals instead.

  • font-weight specifies the boldness or lightness of the characters.

  • font-stretch specifies whether text should be expanded.

  • line-height specifies the height of a line.

  • font-size refers to the size of a font.

Here's an example using some of these style attributes to display italic, bold, and underlined text:

(Listing 21-05.html on the web site)
 <HTML>      <HEAD>          <TITLE>              Text Styles          </TITLE>  <STYLE>   P {font-size:12pt; font-style:italic; font-family:   Arial; text-align:center}   </STYLE>  </HEAD>      <BODY>          <H1>              Text Styles          </H1>          <P>  Here is some   <SPAN STYLE="font-weight: bold">bold</SPAN>   and   <SPAN STYLE="text-decoration: underline">   underlined</SPAN> text.  </P>      </BODY>  </HTML> 


Inside Javascript
Inside JavaScript
ISBN: 0735712859
EAN: 2147483647
Year: 2005
Pages: 492
Authors: Steve Holzner

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net