Publishing Books Using XML Technologies
Dr. Herong Yang, Version 4.01

What Is CSS?

This section provides you some basics of CSS (Cascading Style Sheets).

CSS (Cascading Style Sheets) is a Web technology that allows you to control how Web page elements should be presented in the browser window. CSS controls page element presentation by setting element's properties. Here are some examples of page element properties that can be controlled by CSS:

  • Element Margin - How much white space there will be around the element.
  • Colors - What color to use for the background and the foreground text.
  • Text Font - What font and what size to use for the text.
  • Text Alignment - How text should be aligned, left, center, right, top, or bottom.

CSS also has a set of rule to allow you to select which specific element in the HTML document to apply the style properties. Here are some common selection rules:

  • tagName {...properties...} - Selecting all elements that has the specified tag name.
  • tagName.className {...properties...} - Selecting all elements that has the specified tag name and the class name.
  • tagName.className#idName {...properties...} - Selecting all elements that has the specified tag name, the class name and the id name.

The following CSS example tells the browser to select all <p class="bookToc" ...> elements and apply the margin and font weight as specified:

p.bookToc {margin: 8px 25px 0px 25px; font-weight: bold;}

Table of Contents

 About This Book

 Ideas on Publishing Books using XML

 Overview of hyPub - A Simple XML Publishing Tool

 Writing Book Contents in XHTML Source Files

 Transforming Book Source Files with XSL Technology

 Designing Web Page Layouts with Tables

Controlling Web Page Appearance with CSS

What Is CSS?

 Suggested CSS Definitions for Book Web Pages

 Assigning CSS Files to Web Pages

 Sharing HTML Codes with JavaScript Files

 Generating Web Pages with hyPub

 Formatting Printable Documents with XSL-FO

 Generating PDF Documents with hyPub

 Areas of Future Improvements

 References

 PDF Printing Version

Dr. Herong Yang, updated in 2007
What Is CSS?