CSS Inclusion Example




CSS Inclusion Example

<!DOCTYPE html>
<html>
   <head>
      <style type = "text/css" media = "all">
         body {
            background-color: linen;
         }
         h1 {
            color: red;
            margin-left: 30px;
         }
      </style>
   </head>   
   <body>
      <h1>This is a heading</h1>
      <p>This is a paragraph.</p>
   </body>
</html>

Output

Inline CSS The style Attribute Example

<html>
   <head>
   </head>
   <body>
      <h1 style = "color:#36C;"> This is inline CSS </h1>
   </body>
</html>

Output

CSS Comments Example

<!DOCTYPE html>
<html>
   <head>
      <style>
         p {
            color: blue;
            /* This is a single-line comment */
            text-align: center;
         }
         /* This is a multi-line comment */
      </style>
   </head>
   <body>
      <p>Hello World!</p>
   </body>
</html>

Output