Page 41 - 2403_Trackpad_V5.1_C6_Fb
P. 41
For Example:
<!DOCTYPE HTML>
<HTML>
<HEAD>
<STYLE>
BODY {BACKGROUND-COLOR:YELLOW}
H1 {COLOR:RED;}
H2 {COLOR:GREEN;}
</STYLE> Primary language for webpage designing
</HEAD>
This code will display the H1 heading in red and H2 in green colour on the webpage.
EXTERNAL CSS
External CSS allows us to define the style for many webpages by using a single CSS file. An external
style sheet is a separate file that can be written in any text editor. It does not contain any HTML
code and is saved with .css as the 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
the external stylesheet is:
<HEAD>
<LINK REL=“STYLESHEET” TYPE=“TEXT/CSS” HREF=“PATH OF STYLE SHEET”>
</HEAD>
Where the HREF attribute contains the path of the stylesheet.
USE OF INLINE CSS WITH HTML5 TAGS
You know the inline CSS and its basic syntax. Let us learn more about them.
The background colour of the webpage is set to CYAN with all other specified properties displayed
on the webpage.
Tick ( ) if you know this.
▶ Inline CSS allows us to add styles directly to an HTML tag by using the style attribute.
▶ Internal CSS allows us to define the style for a single HTML page.
Learn HTML5 and CSS3 39

