reading-notes

what is CSS ?

CSS

CSS (Cascading Style Sheets) is a declarative language for controlling the appearance of webpages in browsers. To display items properly, the browser applies CSS style declarations to them. The attributes and values that govern how a webpage appears are contained in a style declaration.

CSS stands for Cascading Style Sheets.

CSS and HTML work hand in hand:

Why we use CSS?

CSS can be added to HTML documents in 3 ways:

As example:

<p style="color:white; background-color: gray;"  > 
This is an example of inline styling. </p> 

As example: this code styles all paragraphs

 
<html> 
<head> 
<style> 
P {
color:white;
Background-color:gray;
} 
</style> 
</head> 
<body>
<p>This is my first paragraph. </p>
<p>This is my second paragraph. </p>
</pody>
< / html > 

With this method, all styling rules are contained in a single text file, which is saved with the .css extension. This CSS file is then referenced in the HTML using the <link> tag. The <link> element goes inside the head section.

as example: the html

The CSS

Both relative and absolute paths can be used to define the href for the CSS file. In our example, the path is relative, as the CSS file is in the same directory as the HTML file.

CSS color Property:

The color property specifies the color of text.

CSS Syntax: color: color|initial|inherit;