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

Hour 15. 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 or later browsers. I didn't include those here because a great many people today are still using version 4 browsers, but you can find the complete CSS1 specification online at www.w3c.org.

  • font:— Enables you to 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. This sequential testing leads to the basic design rule that the list of fonts begins with the one you would most like to use. After that you use font types in decreasing order of interest, and the list is terminated with one that is guaranteed to be available on all platforms. You can also include the words bold and italic and a font size. Each of these font properties can be specified separately with fontfamily:, 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 10, “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 a url(address) where address points to a background image tile. Note that this can be assigned not only to the <body> tag, but also 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 or later browsers.)



Not a subscriber?

Start A Free Trial

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