24.08.2016 Views

(Shelly Cashman Series) Gary B. Shelly, H. Albert Napier, Ollie N. Rivers-Web design_ introductory concepts and techniques -Cengage Learning (2008)

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Step 5: Design the Look <strong>and</strong> Feel of the Site 107<br />

CSS <strong>and</strong> Formatting<br />

In the past, <strong>Web</strong> <strong>design</strong>ers were critical of the HTML markup language, stating that it<br />

afforded few options to control the look <strong>and</strong> feel of <strong>Web</strong> pages. The W3C responded to this<br />

criticism with a multifeatured specification for HTML called Cascading Style Sheets (CSS),<br />

introduced in Chapter 1. The CSS specification allows <strong>Web</strong> <strong>design</strong>ers to use a text<br />

document, called a style sheet, to control the appearance of one or more pages at a site.<br />

You might be familiar with using styles when working with word-processing software.<br />

In this context, a style is a group of formatting properties, such as bold, italic, font type,<br />

font size, or font color, applied as a group to selected text. Similarly, when you use CSS,<br />

you create a style sheet containing style rules that allow you to specify one or more formatting<br />

properties <strong>and</strong> their values for specific HTML tags. For example, suppose you<br />

want all the top-level heading text surrounded by the HTML heading style<br />

tag pair to be a blue color. You could create a style rule for the heading tag consisting<br />

of the heading tag itself, called the style rule’s selector <strong>and</strong> the CSS property: value<br />

combination {color: blue}, called the style rule’s declaration. You can add this style rule to<br />

your pages in one of three ways:<br />

• As an inline style inserted within the HTML tag on a page<br />

• As part of an internal style sheet inserted within a page’s HTML heading tags<br />

• As part of an external style sheet saved in the folder with the site’s pages <strong>and</strong><br />

linked to them with an HTML tag<br />

Q&A<br />

@SOURCE<br />

What is the current<br />

W3C st<strong>and</strong>ard for CSS<br />

<strong>and</strong> do all browsers<br />

support it?<br />

The current W3C style<br />

sheet st<strong>and</strong>ard is CSS<br />

Level 2.1. Microsoft<br />

Internet Explorer <strong>and</strong><br />

Mozilla Firefox have<br />

improved support for<br />

CSS; some browsers or<br />

older browser versions<br />

do not fully support<br />

CSS. The development<br />

of CSS st<strong>and</strong>ards is<br />

ongoing; CSS Level 3<br />

(CSS3) is in various<br />

draft stages.<br />

CSS<br />

For more information<br />

about the W3C st<strong>and</strong>ards<br />

for CSS, visit the <strong>Web</strong><br />

Design Chapter 4<br />

Online Companion page<br />

(scsite.com/web3e/ch4/)<br />

<strong>and</strong> then click CSS in the<br />

@Source links.<br />

Because no current browser supports all CSS specifications, be sure to test how<br />

your <strong>Web</strong> pages formatted using CSS display in different browsers.<br />

DESIGN<br />

TIP<br />

Style sheets centralize formatting, which saves time <strong>and</strong> simplifies the process of<br />

creating <strong>and</strong> modifying <strong>Web</strong> pages. By using style sheets, you can avoid inserting HTML<br />

tag formatting attributes <strong>and</strong> values for individual tags. Using style sheets also helps you<br />

maintain visual consistency across all pages at your site. Modern WYSIWYG editors,<br />

such as Expression <strong>Web</strong>, provide CSS tools you can use to create <strong>and</strong> edit style sheets<br />

<strong>and</strong> link style sheets to your pages plus templates with style sheets already linked to them<br />

(Figure 4-8). You can also create style sheets using CSS editor software, such as Style<br />

Master CSS Editor ® or Rapid CSS Editor 2007 ® (Figure 4-8). To learn more about using<br />

CSS, check out Appendix C at the back of this text.

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

Saved successfully!

Ooh no, something went wrong!