The CSS to create

When a style sheet is read, the browser formats the HTML document against it.

 

How do I insert a style sheet

There are three ways to insert a stylesheet:

  • External Style Sheets
  • Internal Style Sheet
  • Inline style

External style sheets

External stylesheets are ideal when styles need to be applied to many pages. In the case of external stylesheets, you can change the look of an entire site by changing one file. Each page links to the style sheet using tags. At the head of (a document) :

    <head>
        <link rel="stylesheet" type="text/css" href="mystyle.css">
    </head>
Copy the code

The browser reads the style declaration from the file mystyle.css and formats the document according to it.

External stylesheets can be edited in any text editor. The file cannot contain any HTML tags. Stylesheets should be saved with the.css extension. Here is an example of a stylesheet file:

    hr {color:sienna; }p {margin-left:20px; }body {background-image:url("/images/back40.gif"); }Copy the code

 

Internal style sheet

Internal style sheets should be used when individual documents require special styles. You can use the <style> tag