Page 118 - CodePilot V5.0 C6
P. 118
H1 {COLOR: FORESTGREEN; BACKGROUND-COLOR: HONEYDEW; }
P {COLOR: BLUE; BACKGROUND-COLOR: LIGHTGREEN;}
Now, save the file with the name style.css in the same location as your HTML file. If the file is saved
in a different location than the HTML file, you need to specify the complete or absolute path. Open
a new Notepad window and type the following code:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<TITLE>External CSS</TITLE>
<LINK REL="STYLESHEET" TYPE="TEXT/CSS"
HREF="style.css">
</HEAD>
<BODY>
<H1>Importance of Recycling</H1>
<P>Recycling helps conserve natural resources, save energy and reduce
pollution. It is essential for a sustainable future. </P>
</BODY>
</HTML>
You can use 6-digit hex codes for colours, e.g., #000000 for black and #FFFFFF for white.
In CSS, the priority order is: inline > internal > external. This means that if you specify inline, internal
and external CSS for an element, the inline CSS will be applied first, followed by internal CSS and
then external CSS.
You can easily find the colour codes by simply searching colour picker on Google. Then, select the
appropriate colour according to your needs.
RAPID RECALL Tick ( ) if you know this.
1. CSS eliminates the need to repeat code in every HTML tag.
2. A combination of a property and its value is called a Declaration.
116
CodePilot (V5.0)-VI

