DEV Community

Cover image for [VISUAL] CSS Intro, Syntax & the CSS Cascade
Mohamed Yahia
Mohamed Yahia

Posted on

[VISUAL] CSS Intro, Syntax & the CSS Cascade

Image description

CSS Syntax

Image description

Image description

Image description

Image description

CSS Specificity

Image description

Image description

Image description

Link CSS to HTML

To write the css in a seperate file, you have to link that file to the html.
In the head element, make a new element called link and write this:

<head>
    <link href="styles.css" rel="stylesheet"/>
</head>
Enter fullscreen mode Exit fullscreen mode

href attribute specifies the path of the file, if the file is in the same directory as the html, then you just write the file name.

href stands for hypertext reference and yes the value of that attribute (the path) is a reference to the file.

rel stands for relation and here we are specifying the relation of that file we referenced. Is it a stylesheet file, a favicon, it is an alternative page in a different language?

Top comments (0)