1 - Introduction

Introduced in 1990, CSS is becoming widely used in web design and well supported by web browsers. CSS (Cascading Style Sheets) is a language that groups together formatting features associated with groups of elements in a single document. You only need to define a set of definitions and formatting characteristics by a name, and call it to apply to a text. A css code is inserted between the head and /head tags while its effect applies to the entire web page in question.

2 - General syntax of a css code

The syntax of a css code is as follows:

Tag selector {property: values;}

The selector: This is usually the element or the html tag to which you want to apply the style. The property: is the attribute that we want to modify by entering a value. Example: Here is the css code to put all H1 tags in red and centered:

H1 {color: red; text-align: center;}

3 - Inserting CSS code 

3.1 - Internal method on HTML page 

This method frames the css code between the tags :

< style> 
css code here
</ style>

and integrates it directly between the < head> and </ head> tags. 

3.2 - External method to the HTML page 

This method makes it possible to store the css code in a file whose extension is .css for example style.css and apply it to the html pages by inserting between the tags head and /head a link of the type:

< link href="style.css" rel="stylesheet" type="text / css">< /link>
Younes Derfoufi

Leave a Reply