Page 150 - Dig_CodeAI_V2.1_Class_8
P. 150
Info Hub: HTML5 & CSS3
Now that you know how to create an HTML document and view it in the browser, let us explore some
of the tags that can be used to align and style the page content in the body section.
Styling HTML5 Documents with Cascading Style Sheets
CSS stands for Cascading Style Sheets. It is a design language which enables to simplify the process
of making web pages. It helps to save a lot of time as one design layout can be used to make number
of web pages. The latest version of CSS is CSS3. Earlier, CSS2 was used.
CSS comprises style rules that are interpreted by the web browser and then applied to the
corresponding elements in HTML web page. Syntax of Cascading Style Sheet:
The Cascading Style Sheet has two parts: selector and declaration.
Selector Declaration
H1 { Color : Blue; Font-Size : 12 px; }
Property Value Property Value
The selector specifies the element to which we want to apply the formatting and the declaration
specifies the formatting to the selector.
The property of CSS is used to create a style.
Value is the valid value for the property.
A semicolon should be used at the end of the property value, if more than one property is used.
Some of the properties and their values used with the style attribute are given below:
Property Value Description
Background-Color Name of the colour Specifies background colour.
Color Name of the colour Specifies the text colour used in the
webpage.
Text-Align Left, Right, Center, Justified Specifies the alignment of the text.
Font-Family Name of the font Specifies the font of the text used in the
webpage.
Font-Size Value is given in Pixels. The default Specifies the font size used in the
font size for the text is 16px. webpage.
Using CSS Style
There are three ways to use the CSS styles in HTML document which are:
Inline Style Sheet Internal Style Sheet External Style Sheet
148 DigiCode AI (Ver. 2.1)-VIII

