• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL

Hour 16. Using Style Sheets > Style Properties

Style Properties

The following list explains everything that you can reliably do with style sheets if you want to stay compatible with Microsoft Internet Explorer 3 or later and Netscape Navigator 4 or later. The CSS1 standard includes a number of additional formatting options, some of which are supported by version 5 browsers. I didn't include those here since a great many people today are still using version 4 browsers, but you can find the complete CSS1 specification online at http://www.w3c.org.

  • font: Lets you set many font properties at once. You can specify a list of font names separated by commas; if the first is not available, the next is tried, and so on. You can also include the words bold and/or italic and a font size. Each of these font properties can be specified separately with font-family:, font-size:, font-weight: bold, and font-style: italic if you prefer.

  • line-height: Also known in the publishing world as leading. This sets the height of each line of text, usually in points.

  • color: Sets the text color, using the standard color names or hexadecimal color codes (see Hour 11, "Custom Backgrounds and Colors" ).

  • text-decoration: Useful for turning link underlining off—simply set text decoration to none. The values of underline, italic, and line-through are also supported.

  • text-align: Aligns text to the left, right, or center (just like the <div align> HTML attribute). The CSS1 standard allows a value of justify for text aligned to both the left and right margins, but current version browsers do not display full-justified text reliably.

  • text-indent: Indents beyond the left margin by a specified amount. You can say how far to indent in units (px, in, cm, mm, pt, pc), or you can specify a percentage of the page width (such as 20%).

  • margin: Sets the left and right margins to the same value, which can be in measurement units or a percentage of the page width. Use margin-left: and margin-right: if you want to set the left and right margins independently, and margin-top: to set the top margin.

  • background: Places a color or image behind text, either with a color or an url(address) where address points to a background image tile. Note that this can be assigned not only to the <body> tag, but to any tag or span of text to "highlight" an area on a page. (Also note that it doesn't always work quite right in Microsoft Internet Explorer 3, although it generally works fine in version 4 browsers.)



Not a subscriber?

Start A Free Trial

  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint