Cascading Style Sheets!

Allow HTML authors to specify a common set of styles and spacing instructions for elements on
a page.

For example if web site with 5 different pages, might use style sheets to specify things like:


The Technology that has advantages:

Disadvantages:


Probably best used for intranets where can control browser types.

Also would want to include a script that detects the version of browser (See JavaScript).
 
 
 



Types of Style Sheets

Style sheets can be used in 3 different ways:


 
 
 



Using Style Sheets
 

Here is an example web page with a style sheet.

  • Here is the Style Sheet Part:

  •         <STYLE TYPE="text/css">
                H1 {Color: red;
                    font-size: 24pt; }
                H2 { Color: green;
                     font-size: 12pt; }
            </STYLE>
    You should notice:

    Linked or External Style Sheets
           One of the most powerful way to use CSS is to use external file that has all the style information

    Selectors

    Selectors - Class selectors

    Selectors - Special Built-in Classes

    There is a set of classes that are special built-in. One set is used within the the <A> tag.

     
     For example here is a style sheet:
                         A:link { color: red }
                         A:visited { color: maroon }
                         A:active { color: lime }
    Here is an example that uses  it.
     

     
     
     



    Another Embedded  Style Sheet Example
     
     

    Properties - font-family

    Here are some properties that are useful for the basic type-related selectors




    Properties - font-style
    Here are some properties that are useful for the basic type-related selectors




    Properties - font-weight

    Here are some properties that are useful for the basic type-related selectors


     



    Properties - font-size
     

    Properties - font-color
     

    Properties - line-height
     

    Properties - text-transformation
     
     
     
     
     



    Properties - text-indent
     

    Background Properties -
     




    Background Properties -
     




    A large Example  -

    Here is a CSS used in the following example:

                                    P.first { text-indent: 12pt }
                                    H1.title { text-transform: uppercase }
                                    H2 { font-size: 33pt }
                                    H1 { color: red }
                                    EM { font-size: 18pt; font-style: Times, serif; color: FF00FF }
                                    STRONG { font-weight: 900; background-color: silver }
                                    BODY { background-color: yellow }