Page 24 - CSS
P. 24

Chapter 1: Getting started with CSS




        Remarks



        Styles can be authored in several ways, allowing for varying degrees of reuse and scope when
        they are specified in a source HTML document. External stylesheets can be reused across HTML
        documents. Embedded stylesheets apply to the entire document in which they are specified. Inline
        styles apply only to the individual HTML element on which they are specified.


        Versions




          Version    Release Date

          1          1996-12-17


          2          1998-05-12

          3          2015-10-13



        Examples



        External Stylesheet


        An external CSS stylesheet can be applied to any number of HTML documents by placing a <link>
        element in each HTML document.

        The attribute rel of the <link> tag has to be set to "stylesheet", and the href attribute to the
        relative or absolute path to the stylesheet. While using relative URL paths is generally considered
        good practice, absolute paths can be used, too. In HTML5 the type attribute can be omitted.


        It is recommended that the <link> tag be placed in the HTML file's <head> tag so that the styles are
        loaded before the elements they style. Otherwise, users will see a flash of unstyled content.



        Example



        hello-world.html


         <!DOCTYPE html>
         <html>
             <head>
                 <meta charset="utf-8" />
                 <link rel="stylesheet" type="text/css" href="style.css">
             </head>
             <body>
                 <h1>Hello world!</h1>


        https://riptutorial.com/                                                                                2
   19   20   21   22   23   24   25   26   27   28   29