Cascading Style Sheets
Cascading Style Sheets (CSS) provide a way to
control the look and feel of HTML pages in an organized and
efficient manner. Teaching how to design and write the code for
CSS is beyond the scope of this book, but it does warrant some
explanation. Methods for creating templates for use in HTML DB
will be covered later in this text, and there will likely come a
time when developers will want to use their own CSS to change the
CSS provided by HTML DB.
Including CSS in HTML DB is accomplished in
the same manner as JavaScript as covered in the Adding JavaScript
to an Application Page section earlier in this chapter. For the
HTML DB developer, it will be important to understand there are
three ways to reference CSS in HTML code. These are referred to
as internal, external, and inline. Internal and external CSS are
included at the application page level between the <head> and
</head> tags. Inline is used directly within an html tag such as
the paragraph (<p>) tag. In HTML DB, it is valuable to know how
to use inline CSS with page level items.
Another important factor to understand is that
CSS has a pecking order. That is, it has a priority based on
where it is included in the HTML code. Inline CSS has the highest
priority and will override any previously defined, internal or
external, CSS code. In terms of the internally and externally
defined CSS, the pecking order is dependent upon its location in
the <head> tag. Since HTML is rendered from top-down, the latest
CSS will override something defined above it. What this means is
that if one CSS statement defines a CSS property for a page item
such as setting the font color to red and the next CSS statement
defines the color as blue, the second definition will override the
first and the resulting color will be blue. This is a handy
little piece of information because it allows a CSS style to be
overridden in the HTML DB themes by simply redefining it. An
example will be included later in this book.