How do I use external CSS styles?



  • An external CSS style is used by referencing an external file, with a .css suffix.

    For example an html document references the external CSS stylesheet using the <link> tag within the <head></head> tags

    ...
    <head>
       ...
       ...
      <link rel="stylesheet" href="style.css">
    </head>
    <body>
        <p>Lorem ipsum dolor sit, amet consectetur adipisicing elit. Quod, laudantium aspernatur. Officia, consequatur! Fugit in obcaecati voluptatem doloremque beatae nisi!
        </p>
    </body>
    ...
    

    The CSS stylesheet style.css has the following entries.

    p {
        background-color: red;
        color: white
    }
    

    The result in the browser is:
    520284c4-31ef-4d32-a5fb-896f8c35edcf-image.png


Log in to reply
 

© Lightnetics 2024