Page 72 - TP-Play_V-2.0_Book-6
P. 72

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 any location 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:



























            You  can  also  use  the  6  digits  hexadecimal  code  in  place  of  colour  name.  For  example,  the
            hexadecimal code #000000 represents the black colour and #FFFFFF represents the white colour.
            For example:

            body{background-color: #000000;}

            You can also set an image as background of a web page by using the background-image property
            of CSS in the following manner:

            body{background-image:url("background.jpg");}


             72       Play (Ver. 2.0)-VI
   67   68   69   70   71   72   73   74   75   76   77