Monday 21st of August 2017 02:38:24 AM

Style Guide

CSS: Style Sheet Guidelines (2)

What CSS looks like

A Basic Style Sheet
Note that the BODY declaration establishes the font family, text color, and background color. Any “child” of the BODY declaration (such as <p> or <ol> or <blockquote>) will use these same fonts and colors unless the Style Sheet specifies otherwise. In CSS, this passing of characteristics from “parent” to “child” is called inheritance.
        Notice also that browser offsets have been turned off via the margin and padding declarations. These declarations replace non-standard attributes to the HTML BODY tag, such as “marginheight” and “marginwidth,” which should never, never, never be used.
Redundant Selectors
Notice that p and li reproduce the font-family information already declared by BODY. According to the rules of inheritance, this should not be necessary. Unfortunately, this redundancy is required to work around the defects of Netscape Navigator 4, which ignores inheritance because it lacks even the most basic CSS compliance.  
A Sophisticated Style Sheet (offsite link)
Demonstrating how CSS can entirely replace (X)HTML table layouts. View in a CSS–capable browser (IE5+, Netscape 6+, Mozilla, Opera 5) to see how the Style Sheet creates the page layout. (View the same site in IE4 or Netscape 4 to see how the layout is hidden from those browsers, since they are incapable of reproducing it.)

CSS Usage at NYPL

View Source, and you'll see that this Style Guide has been laid–out entirely with CSS (no (X)HTML table hacks). Alas, for the foreseeable future, most Library projects will employ a combination of CSS and XHTML tables, in order to accommodate non-CSS-compliant browsers such as Netscape Navigator 4 and Microsoft Internet Explorer 4.

Tables and Accessibility

Although XHTML table layouts are less accessible than pure CSS layouts, and although they require additional markup (and thus use more bandwidth), it is entirely possible to create valid XHTML table layouts that work in combination with valid Style Sheets—and that is what this Style Guide recommends.

On the next page, we explore CSS resources to help you learn more. »

« CSS Section Index | CSS Guidelines 3 »

<length> | <percentage>

Initial value



Using the property background-attachment, you can declare the background to be fixed with respect to the viewing area and therefore immune to the effects of scrolling:

BODY {background-image: url(bigyinyang.gif);
background-repeat: no-repeat;
background-position: center;
background-attachment: fixed;}
save better font handling by operating systems. Usually, the italicand oblique fonts look exactly the same in web browsers.

Still, font-style can be useful. For example, itis a common typographic convention that a block quote should beitalicized, but that any specially emphasized text within the quoteshould be upright. In order to employ this effect, shown in Figure 5-28, you would use these styles: possibilities.

Figure 8-27

Figure 8-27. Scaling images with the width property

It's also possible to scale an image (or other replaced element) using height:

<IMG SRC="test.gif" STYLE="display: block;" ALT="test image">
<IMG SRC="test.gif" STYLE="display: block; height: 50px;" ALT="test image">
<IMG SRC="test.gif" STYLE="display: block; height: 200px;" ALT="test image">

This is exactly the same as using the HEIGHT

5.2.1. How Weights Work

In order to understand how a useragent determines the heaviness, or weight, of a given font variant,not to mention how weight is inherited, it's easiest to startby talking about the keywords 100 through900. These numberkeywords were defined to map to a relatively common feature of fontdesign in which a font is given nine levels of weight. OpenType, forexample, employs a numeric scale with nine values. If a font has