Prev | Current Page 103 | Next

Charles Wyke-Smith

"Stylin' with CSS: A Designer's Guide 2nd Edition"


Doing this means that you won??™t have to manage a separate style
sheet, but the styles that you write will only be available to this one
document. That??™s ideal for developing the layout of a single page,
such as the examples we are going to be working on; later, you??™ll cre-
STYLIN??™ WITH CSS - CHAPTER 3 74
ate a separate style sheet that can supply styles to multiple pages.
Review the start of Chapter 2 if this doesn??™t make complete sense.
Let??™s use the XHTML document you created in Chapter 1 and modify
it to include the style element in the document head, as illustrated
by the highlighted code

A Sample XHTML Document




The blank line between the opening and closing tag of the style element
is where you will add your CSS. When the browser encounters
the opening tag of the style element, it stops interpreting the code
as XHTML and starts interpreting it as CSS. When it encounters the
closing tag of the style element, the browser reverts to treating the
code as XHTML again. So anything you write within the style element
must be in CSS syntax, the same syntax you use if the CSS is
in a separate style sheet. This means any code within the style element
is formatted as CSS like this
selector {property1:value; property2:value;}
You need to be aware of whether you are writing CSS or XHTML at
any given moment during the development of your projects and
make sure that you format your code accordingly.


Pages:
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115