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

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


             Free








             eBook









             Edition




                          Illustration 17: Page with External Style Sheet


            Please support this work at


               Internal Style Sheets
                                  http://syw2l.org
               An internal style sheet functions much like an external style sheet, however it is contained within
               the <style>...</style> tag that lies within the <head>...</head> of an HTML
               document. While more organized than inline style, it must be included in every document of your
               website, making is far less convenient than external style. For this reason we recommend using
               external style sheets for more complex Web pages.               Free

               Selectors

               There are several ways to select tags and items in internal and external style sheets, but for now
                                                                   eBook
               we will discuss the main three that you will use most often, which are tags, IDs, and classes.
               Using these selectors properly allow for complex style that can be applied to an entire website.

               Tag Selectors

               Take a look at the previous example of an external style sheet and make a note of the body and
               h1 selectors. This is an example of a tag selector, named that way because it selects tags within
                                                                Edition
               your document to apply style to. A tag selector will apply the specified style to each and every
               instance of that tag throughout your entire document. Referencing the example above, all
               instances of <h1>...</h1> tags on the page will have red text.


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