1 - Introduction

Introduced in the mid-1990, CSS became widely used in web design and well supported by web browsers. CSS (Cascading Style Sheets) is a language that consists of grouping in one document formatting characteristics associated with groups of elements. Just define a set of definitions and formatting characteristics by name, and call it to apply it to text. A css code is inserted between the and tags or in a separate style.css sheet, while its effect is applied to the entire web page in question.

2 - General syntax of a css code 


The syntax of a css code is declared as follows:

Tag selector {property: values; }
  1. The selector:  is generally the element or the html tag to which we want to apply the style.
  2. The property: is the attribute that you want to modify by entering a value. 

Example: 

Here is the css code allowing to put all the H1 tags in red and centered:

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

3 - Inserting the CSS code 

3.1 - Internal page method 


This method encloses the css code between the tags:

<style> and </style> 

and embeds it directly between the tags:

<head> and </head> 

3.2 - External page method  

This method emagazine the css code in a file whose extension is .css for example style.css and introduces in the html pages between the head and /head a tags link of the type:

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

Leave a Reply