What is CSS (Cascading Style Sheets)?

CSS stands for Cascading Style Sheets, this is used to change how html elements are displayed on the screen. You can do inline styling in the HTML file ore create a external style sheet which are saved as a .css file. In order to use CSS, you need to understand HTML first. But you need to know both of them to make a great web page.

How to link from HTML?

If you use an external stylesheet you need to link to it in you HTML head tag.

It should look like this.

<head>
<
link rel=”stylesheet” type=”text/css” href=”mystylesheet.css”>
</head>

How to use CSS?

Lets say you want to style all h1 tags, on your page and make them green.

Then it will look like this

h1 {

color:green;
}

You can use some standard colors or a hex color code.

 

If you want to style on a certain class it will look like this.
You will always need the . before the class name.

.myclass {
background-color:green;
}

This is how to set a class in HTML
<div class=”myclass”>Your content<div>