Class 17 Notes

Cascading Style Sheets

CSS allows for consolidation of similar code - for example:

    Can be used in the <style> element in the heading section of html code

    <h1 align="center"><font color="red">the heading</font></h1>

    <style type="text/css"
        h1 {text-align: center; color: red}
    </style>

    Can also be used as a separate file so that many html pages can reference one CSS

        <link href="bikesite.css" rel="stylesheet">

    That's all there is to it - any changes made to the CSS will be reflected in all pages that reference it.

 

General Rules For Selecting

            h1, h2 {color: green}

           Text inside either <h1> or <h2> elements will be green

            p i {color: blue}

            Text inside an <i> element within a <p> element will be blue

                            .quote {font-style: italic}

                                    <p class="quote">This is a quote</p>