Page 83 - TP_Pluse_V2.2_Class_6
P. 83
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
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");}
Suppose, writing HTML5 code was like casting a spell. What kind of digital spells
would you create, and what effects would they have on your web page?
Introduction to HTML5 and CSS3 81

