Page 68 - PlugGPT_V2.0_C6_Flipbook
P. 68

External Style Sheet

                  In case of external stylesheet, the CSS styles are written in a separate file which is saved with
                  .css extension. You need to include a reference to the external style sheet file within the <LINK>
                  element inside the <HEAD> element. Syntax to include the reference of external stylesheet is:

                  <head>
                  <link rel=“stylesheet” type=“text/css” href=“name of style sheet file">

                  </head>
                  Where, HREF attribute contains the path of the stylesheet. For example, if you have saved the file
                  in which styles are written with the name style.css, then the code will be:

                  <head>
                  <link rel=“stylesheet” type=“text/css” href="style.css">

                  </head>
                  You need to give complete drive path of the stylesheet, if the file is saved at any other location.
                  Let us create a web page using the external style sheet. The first step is to create stylesheet file.
                  Open the Notepad and type the following code:

                  body{background-color:green; color:white;}
                  Now, save the file with the name style.css at same location as that of HTML file. Again, open a

                  new notepad window and type the following code:
                  <!DOCTYPE html>
                  <html>

                  <head>

                  <title> Using External Stylesheet</title>
                  <link rel="stylesheet" type="text/css" href="style.css">
                  </head>

                  <body>

                  Text with white colour and background colour is green
                  </body>

                  </html>
                  When you view the preceding web page in browser, you will get the following output:


















               66       Premium Edition-VI
   63   64   65   66   67   68   69   70   71   72   73