Cascading Style Sheets: Designing for the Web

Cascading Style Sheets: Designing for the Web

by Hakon Lie, Bert Bos
Cascading Style Sheets: Designing for the Web

Cascading Style Sheets: Designing for the Web

by Hakon Lie, Bert Bos

eBook

$32.99  $43.99 Save 25% Current price is $32.99, Original price is $43.99. You Save 25%.

Available on Compatible NOOK Devices and the free NOOK Apps.
WANT A NOOK?  Explore Now

Related collections and offers


Overview

In this updated edition to their original best-selling classic, the co-creators of CSS clearly, logically, and painlessly explain the hows and whys and ins and outs of the visual formatting language that is their gift to us. The Web would be a poorer place without Messieurs Bos and Lie. Your shelf will be richer for the addition of this book.

Rely on it. Study it. Savor it.

The Indispensible CSS Tutorial and Reference–Straight from the Creators of CSS

Direct from the creators of CSS, this is the definitive guide to CSS, today's indispensable standard for controlling the appearance of any Web or XML document. This book doesn't just show how to use every significant CSS 1 and 2.x feature; it carefully explains the "why" behind today's most valuable CSS design techniques. You'll find practical, downloadable examples throughout–along with essential browser support information and best practices for building high-impact pages and applications.

Cascading Style Sheets: Designing for the Web, Third Edition covers every CSS 2.1 improvement and fix, from new height/width definitions in absolutely positioned elements to new clip property calculations. Clear, readable, and thorough, it's the one must-have CSS resource for every Web developer, designer, and content provider. Coverage includes

  • Mastering essential CSS concepts: Rules, declarations, selectors, properties, and more
  • Working with type: From absolute/relative units to font size and weight
  • Understanding CSS objects: Box model, display properties, list styles, and more
  • Exercising total control over spacing and positioning
  • Specifying colors for borders and backgrounds
  • Managing printing: Margins, page breaks, and more
  • Implementing media-specific style sheets for audio rendering, handhelds, and other forms of presentation
  • Moving from HTML extensions to CSS: Five practical case studies
  • Making the most of cascading and inheritance
  • Using external style sheets and @import
  • Integrating CSS with XML documents
  • Optimizing the performance of CSS pages
  • Includes a handy CSS Quick Reference printed on the inside covers

Product Details

ISBN-13: 9780132465731
Publisher: Pearson Education
Publication date: 04/25/2005
Sold by: Barnes & Noble
Format: eBook
Pages: 416
File size: 12 MB
Note: This product may take a few minutes to download.

About the Author

ABOUT THE AUTHORS

HåKON WIUM LIE is the CTO of Opera Software. His job is to make sure Opera remains a better, smaller, and faster browser than the one you know. Before joining Opera in 1999, Håkon worked at W3C, where he was responsible for the development of Cascading Style Sheets—a concept he proposed while working at CERN in 1994. Håkon holds an MS degree in visual studies from the MIT Media Lab.

BERT BOS, along with Lie, was one of the original authors of CSS. He joined W3C in 1995 to launch its internationalization activities and currently coordinates its style sheet activities.


© Copyright Pearson Education. All rights reserved.

Read an Excerpt


Chapter 1: The Web and HTML

Cascading Style Sheets, CSS for short, represents a major breakthrough in how Web page designers work by expanding their ability to control the appearance of Web pages - the documents that people publish on the Web.

Since the World Wide Web (the Web, for short) was created in 1990, people who wanted to put pages on the Web have had little control over what those pages would look like. In the beginning, authors could only specify structural aspects of their pages, for example, that some piece of text would be a heading or some other piece would be straight text. Also, there were ways to make text bold or italic, among a few other effects, but that's where their control ended.

In the scientific environments where the Web was born, people are more concerned with the content of their documents than the presentation. In a research report, the choice of type faces (or fonts, as we call them in this book) is of little importance compared to the scientific results that are reported. However, when authors outside the scientific environments discovered the Web, the limitations of Web document formats became a source of continuing frustration. Authors often came from a paper-based publication environment where they had full control of the presentation. They wanted to be able to make text red or black, make it look more spacedout or more squeezed, to center it or put it against the right margin, or anywhere else they wanted. Many Web designers come from a desktop publishing background, in which they can do all of these things, and more, to improve the appearance of printed material. They want the same capabilities when they design Web pages. However, such capabilities have been slow to develop - slow by Internet speed standards, that is. So designers have devised techniques to sidestep these limitations, but these techniques sometimes have unfortunate side effects. We discuss those techniques and their side effects later in this chapter.

This book is about a new method for designing Web pages. CSS works with HTML (the HyperText Markup Language), which is the primary document format on the Web. HTML describes the document's structure; that is, the roles the various parts of a document play. For example, a piece of text may be designated as a heading or a paragraph. HTML doesn't pay much attention to the document's appearance, and in fact it has only very limited capability to influence appearance. CSS, however, describes how these elements are to be presented to the reader of the document. Now, using CSS, you can better specify the appearance of your HTML pages as well as make your pages available to more Web users worldwide. The release of CSS greatly enhances the potential of HTML and the Web.

A style sheet is a set of stylistic guidelines that tell a browser how an HTML document is to be presented to users. With CSS, you can specify such styles as the size, color, and spacing of text, as well as the placement of text and images on the page. Plus a whole lot more.

A key feature of CSS is that style sheets can cascade. That is, several different style sheets can be attached to a document and all of them can influence the presentation of the document. In this way, the author can create a style sheet to specify how the page should look, while the reader can attach a personal style sheet to adjust the appearance of the page for human or technological limitations, such as poor eyesight or a personal preference for a certain font.

CSS is a simple language that can be read by humans - in contrast to some computer languages. Perhaps even more important, however, is that CSS is easy to write. All you need to know is a little HTML as well as some basic desktop publishing terminology: CSS borrows from that terminology when expressing style. So those of you who have experience in desktop publishing should be able to grasp CSS very quickly. But if you're new to HTML, desktop publishing, and/or Web page design, don't despair. You are likely to find CSS surprisingly easy to grasp. The book includes a brief review of basic HTML as well as tips on page design.

To understand how revolutionary CSS is, you first need to understand Web page design as it has been and the problems that CSS can help solve. In this chapter, we begin with a brief tour of the Web and the problems Web designers and others have faced prior to the introduction of CSS. Then we quickly review the basics of HTML. For those of you who are already publishing on the Web, this all may be old news. For those of you who are new to the idea of designing Web pages, this should help put things in perspective. In Chapter 2, "Enter CSS," we step you through the basics of how to use CSS. In subsequent chapters, we delve more deeply into CSS, covering how you can specify the text, background, color, spacing, and more in the design of your Web pages.

THE WEB

The Web is a vast collection of documents on the Internet that are linked together via hyperlinks. The Internet consist of millions of computers worldwide that communicate electronically. A hyperlink is a predefined link between two documents. The hyperlinks allow a user to access documents on various Web servers without concern for where they are located. A Web server is a computer on the Internet that serves out Web pages on request. From a document on a Web server in California, the user is just one mouse click away from a document that is stored, perhaps, on a Web server in France. Hyperlinks are integral to the Web.Without them, there would be no Web.

Users gain access to the Web through a browser. A browser is a computer program that lets users browse, or "surf," the Web by fetching documents from Web servers and displaying them to the user. To move from one document to another, the user clicks on a highlighted (often underlined) word or image, that represents a hyperlink. The browser then retrieves the document that is at the other end of the hyperlink and displays it on the screen. For example, a user could be in a document about baroque music and click the highlighted words Johann Sebastian Bach which is linked to "Bach's home page" (on the Web, all celebrities - as well as everyone else who wants one - have a home page). When the browser has fetched Bach's home page (instantly in the best case) it will appear on the user's screen.

Development of the Web

The Web was invented around 1990 by Tim Berners-Lee with Robert Cailliau as a close ally. Both of them were then working at CERN, the European Laboratory for Particle Physics. Tim is a graduate of Oxford University and a long-time computer and software expert, and is now Director of the WorldWideWeb Consortium (W3C) an organization that coordinates the development of the Web. He also is a Principal Research Scientist at Massachusetts Institute of Technology's Laboratory for Computer Science (MIT LCS).And he's our boss. Robert is a 20-year veteran at CERN, where he still works. It was Robert who organized the first Web conference in...

Table of Contents

1. The Web and HTML.

2. CSS.

3. The Amazing Em Unit and Other Best Practices.

4. CSS Selectors.

5. Fonts.

6. The Fundamental Objects.

7. Space Inside Boxes.

8. Space Around Boxes.

9. Relative and Absolute Positioning.

10. Colors.

11. Printing and Other Media.

12. From HTML Extensions to CSS.

13. Cascading and Inheritance.

14. External Style Sheets.

15. Other Approaches.

16. XML Documents.

17. Tables.

18. The CSS Saga.

19. HTML 4.0 Quick Reference.

Appendix A. System Colors.

Foreword

When the Web was in its infancy, seven years ago or so, I felt greatly relieved at the final removal of all the totally unsolvable problems of fixed format presentation. In the young Web, there were no more pagination faults, no more footnotes, no silly word breaks, no fidgeting the text to gain that extra line that you sorely needed to fit everything on one page. In the window of a Web page on the NeXTStep system, the text was always clean. Better that that: I decided what font it came out in, how big I wanted the letters, what styles I chose for definition lists and where tabs went.

Then we descended into the Dark Ages for several years, because the Web exploded into a community that had not idea that such freedom was possible, but worried about putting on the remote screen exactly what they thought their information should look like. I've read recommendations against using structure markup because you have no control over what comes out the other side. Sad.

You have by now understood that I'm firmly in the camp of those who think that quality of content comes first, and presentation comes later. But of course, I'm not entirely right here: presentation is important. Mathematical formulas are always presented in a two-dimensional layout.

Fortunately, SGML's philosophy allows us to separate structure from presentation, and the Web DTD, HTML, is no exception. Even in the NeXTStep version of 1990, Tim Berneres-Lee provided for style sheets, though at a rudimentary level (we had other things to do then!)

Today, style sheets are becoming a reality again, this time much more elaborate. This is an important milestone for the Web, and we should stop for a minute to reflect on the potential benefits and pitfalls of the technology.

I followed the CSS effort from its inception - mostly over cups of coffee with Hakon at CERN - and I've always had one concern: is it possible to create powerful enough style sheet "language" without introducing the complexity of programming.

The CSS described in this book shows that you can create some quite stunning presentations without programming. While the programmer in me may be a little disappointed, the minimalist in me is comforted. In fact, I'll never need this much freedom and special effects, but then I'm not a graphic artist. Anything that needs more compilation effectively becomes an image, and should be treated as such. I feel therefore that the middle part of the spectrum between pure ASCII text and full images is effectively covered by the power of CSS, without introducing the complexity of programming.

You have here a book on presentation. But it is presentation of information that should also remain structured, so that your content can be effectively used by others, while retaining the specific visual aspects you want to give it. Use CSS with care. It is the long-awaited salt on the Web food: a little is necessary, too much is not good cooking.

The efforts of the authors have finally brought us what we sorely needed: the author's ability to shape the content without affecting the structure. This is good news for the Web!
From the B&N Reads Blog

Customer Reviews