Page 178 - Computer Software Application TP - Volume 1
P. 178

COMPUTER SOFTWARE APPLICATION - CITS



           TASK 6: Using External Stylesheet

           I  create an external stylesheet
              1  Open the text editor
              2  Write the following codes
                 /* styles.css */
                 body {
                 font-family: Arial, sans-serif;
                 background-color: #f0f0f0;
                 color: #333;
                 }
                 h1 {
                 color: #007bff;
                 }
                 .container {
                 width: 80%;
                 margin: 0 auto;
                 padding: 20px;
                 background-color: #fff;
                 border-radius: 5px;
                 box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
                 }
                 p {
                 line-height: 1.6;
                 }
              3  Save the coding as a style.css file
           II  Link the css file in HTML
              1  Open the text editor
              2  Write the following codes
                 <html>
                 <head>
                 <meta charset=”UTF-8”>
                 <meta name=”viewport” content=”width=device-width, initial-scale=1.0”>
                 <title>External CSS Example</title>
                 <link rel=”stylesheet” href=”styles.css”>
                 </head>
                 <body>
                 <div class=”container”>
                 <h1>Welcome to my website</h1>
                 <p>This is a paragraph with some text.</p>
                 </div>
                 </body>
                 </html>
              3  Save the program as a .html file
              4  Open the html file with a web browser
              5  Verify the output.






                                                           163
                               CITS : IT & ITES - Computer Software Application - Exercise 44
   173   174   175   176   177   178   179   180   181   182   183