Добавил:
Upload Опубликованный материал нарушает ваши авторские права? Сообщите нам.
Вуз: Предмет: Файл:
Taking_Your_Talent_to_the_Web.pdf
Скачиваний:
5
Добавлен:
11.05.2015
Размер:
9.91 Mб
Скачать

190 HOW: HTML, the Building Blocks of Life Itself: HTML as a Design Tool

Figure 8.1

This site for the Web Standards Project contains almost no graphics. The shapes and colors are created using nothing more than HTML and CSS. It is possible to fill the screen with color and content without wasting bandwidth on images. As a bonus, the code validates (www.webstandards.org).

HTML AS A DESIGN TOOL

Though this won’t always be the case, one of the beautiful things about HTML (and eventually, CSS instead) is that it can be used as a powerful design tool—a design tool that loads instantly. No images are required; there are no fancy plug-ins and no worries about every user having the latest browser.

Consider the front page of The Web Standards Project (www.webstandards. org). Aside from one large Seymour-Chwast-like illustration, the rest of the front page is designed entirely with HTML and CSS. Now view the source.

An HTML color in the <BODY> tag defines the entire background. The content grid is made up of a table, and the grid areas and background colors are defined with table cell colors.

Taking Your Talent to the Web

191

The content area is enclosed within a black outline created with one line of CSS. Originally, the same effect was created by wrapping one HTML table inside another.

CSS is used to create the typography and leading.

Creating a layout like this in Photoshop, cutting its elements into pieces, and assembling those pieces via HTML, would have resulted in a large web page composed of many small files that would take a long time to download. (And if the visitor had images turned off, the visual effect would be lost.)

Creating the layout in HTML and CSS means that the page loads almost instantly, no matter how slow the visitor’s connection may be. And the layout is backward compatible with browsers dating back to Netscape 3 (a 1997 browser), although the CSS formatting will be lost in that browser. Actually, the site is viewable in any browser. Older browsers will lose the design branding effects, but the content will still be readily accessible.

Note that this is a transitional web design strategy. It respects bandwidth by using web technology (instead of image files) to create visual and branding effects—but at the cost of relying on deprecated presentational HTML attributes. Most of these effects can be generated in CSS alone, with HTML serving simply as the structural container of content. This is what the W3C recommends, and this is the way we will build all sites in the near future and forever after. (We’re doing it at alistapart.com.)

However, as we mentioned in Chapter 2, old browsers that do a poor job at understanding CSS are still widely used in the market we serve. And as you’ll see in Chapter 10, browsers that stumble over CSS don’t simply render it incorrectly. They can actually crash and burn. For this reason, as you begin your career in web design, you will undoubtedly be using HTML tables and other deprecated presentational HTML attributes to control your web layouts and visual effects. Thus there is value in learning how to do this in ways that minimize wasted bandwidth and comply with the letter (though not the spirit) of W3C standards. The lessons you learn in building sites this way will apply equally well when you are free to control your site designs exclusively with CSS.

192 HOW: HTML, the Building Blocks of Life Itself: HTML as a Design Tool

Other sites that use HTML or XHTML as a creative design tool (abetted by CSS):

www.glish.com (designed by Eric Costello)

www.harrumph.com (designed by Heather Champ)

www.assembler.org (designed by Brent Gustaffson)

www.kottke.org (designed by Jason Kottke)

www.blogger.com (designed by Derek Powazek)

a.jaundicedeye.com/weblog/ (designed by Steven Champeon)

www.zeldman.com (designed by Zeldman)

www.alistapart.com (designed by Zeldman)

Use View Source to see how these sites use HTML table cells and table cell colors, CSS fonts, leading, margins, and background images to create full-

Figure 8.2

This site, though colorful, contains few graphics. Big color sections are created with CSS and HTML <DIV>s. The technique facilitates Liquid Design, reduces bandwidth, and makes the site more accessible (www.alistapart.com).

Taking Your Talent to the Web

193

fledged visual experiences using nothing more than code (and a few lowbandwidth images).

PLUG-INS AND TABLES AND FRAMES,

OH MY!

In the transitional Web, designers use HTML tables to lay out pages, as just described (with additional commentary and how-to-do-it type verbiage to come in the next chapter). We also use <FRAMES>, a Netscape “extension” to HTML which has temporarily made it into the HTML 4 Transitional standard but which will eventually go the way of the Dodo bird.

Frames are nothing more than pages within pages, for example:

<FRAMESET COLS=”80,2,*” frameborder=”no” border=”0” framespacing=”0”> <FRAME SRC=”nav.html” NAME=”nav” marginwidth=”0” marginheight=”0” noresize scrolling=”auto”>

<FRAME SRC=”black.html” NAME=”black” marginwidth=”0” marginheight=”0” noresize scrolling=”no”>

<FRAME SCROLLING=auto SRC=”content.html” NAME=”content” marginwidth=”0” marginheight=”0”>

</FRAMESET>

In this markup, <FRAMESET> tells the browser that the page contains frames. <COLS> (short for columns) specifies that the frameset contains three columns. The first is 80 pixels wide; the second is 2 pixels wide; and the last fills the remaining width of the browser window.

We also can tell the browser whether or not we want borders on our frames; whether or not each frame should permit the viewer to scroll content; whether or not each frame is user-resizable; and what size margin we’d like on each frame. Because we’re designers, we turn margins off entirely (marginwidth=”0” marginheight=”0”) and use CSS or tables to control the margins on each individual frame—each frame, of course, being nothing more than an HTML document (nav.html, black.html, content. html).

We also name each frame for targeting purposes. After all, when visitors click in a menu area, we want the content they’ve chosen to show up in the content frame—not in the menu frame. Assigning a target name to each

Соседние файлы в предмете [НЕСОРТИРОВАННОЕ]