Table of Contents

~~TOC~~

Lab46 Tutorials

CSS

Cascading Style Sheets

CSS was adopted in the mid 1990's as a way to standardize web pages. Style sheets can be used with many markup languages such as html, xml, svg and xul. It is used for defining the way a document looks. It accomplishes this by giving attributes (colors, fonts) to the tags in a markup language. Before style sheets all attributes had to be added to each tag individually. This can Be very inefficient for a site that has many pages. A style sheet allows an entire page or site to be standardized.

First Style Sheet

    p  {font-size: 50%; font-family: sans-serif;}
    h1 {color: red; font-weight: bold;}

save file as style.css

<html>
    <head>
        <style type= "text/css">
            @import "style.css";
        </style>
        <title>My New Web Page</title>
    </head>
    <body>
        <h1>Hello world</h1> 
        <p>
        this is my new web page!
        </p>
    </body>
</html>

save file as index.html

view in web browser

Common Attributes