Page 63 - Learn To Use HTML and CSS
P. 63

So You Want to Learn to Use HTML and CSS – Version 2020-06-12a                        Page 53
               Chapter 5 — Internal and External Style Sheets


             Free
               <link href="sheet.css" rel="stylesheet" type="text/css">



                       The href attribute stands for "hypertext reference" and is used to load or "reference"
                   •
                       your external style sheet. Most style sheets will end with the .css extension. You can
                       name your CSS document however you'd like, but be sure to spell it the same way in
             eBook
                       your HTML as it is saved, and be wary of capitalization.
                       rel is short for relation and communicates to the HTML document what kind of item it
                   •
                       is reading.

                   •   The type attribute communicates to the HTML document what kind of characters it can
             Edition
                       be expected to read.
               Here is an example of an external style sheet and the accompanying HTML document. Note that
               anything written within a /* */ will not be interpreted by the web browser, and can be used to
               make notes for yourself or others that are working with you:


            Please support this work at
               /* sample.css - Sample CSS Sheet for Chapter 5 */
               /* a rule for the body that cascades to all of the child elements */
               body {
                       font-family: Tahoma, Verdanda, Arial, sans-serif;
               }                  http://syw2l.org

               /* a rule for the h1 tags */
               h1 {
                       font-family: "times new roman", serif;
                       color: red;                                             Free
               }

               /* this rule just changes the element with the id mainmenu */
               #mainmenu {
                       background-color: grey;
                       color: blue;
               }                                                   eBook

               /* apply this style to all tags with the class "bright" */
               .bright {
                       background-color: yellow;
                       color: orange;
                                                                Edition
               }

               /* apply this style to all tags with the class "dull" */
               .dull {


               Copyright 2020 — James M. Reneau PhD — http://www.syw2l.org — This work is
               licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
   58   59   60   61   62   63   64   65   66   67   68