• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint

Style Sheets and XHTML

This chapter will introduce you to style sheets, and teach you how to implement them in your pages. All of the information in this chapter is as applicable to HTML as it is to XHTML. However, there are a few important things to bear in mind when it comes to using CSS with XHTML:

  • Because XML describes CSS as CDATA (content data), style in XML and XHTML are supposed to be marked up using the CDATA element. However, because most current HTML browsers will choke on the CDATA element, your pages might be rendered unreadable, or displayed in odd ways:

    <style type="text/css">
    <!—
    /* <![CDATA[ */
    
    BODY
    {
    color: white;
    background-color:black;
    }
    
    /* ]]> */ —>
    </style>
    

    So, it's important to remember this method, but set it aside unless you're working on pages that will be rendered in XML-compliant browsers only.

  • Although you can use any of the style methods (linked, embedded, or inline) in XHTML 1.0 transitional documents, it is highly recommended that you begin to use linked style sheets only, avoiding any rendering problems and truly living up to the "separate document formatting from presentation" concept inherent to HTML 4.0 and XHTML 1.0.

  • In a strict XHTML 1.0 document, use a linked document.


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint