CSS (Cascading Style Sheets) is a style sheet language that is used to style HTML documents. To use CSS you need to have an HTML file.
Create a new CSS file
I will use Visual Studio Code to do this. If you want to install it, read this post. Click File and then New File
It is good to save the file at the beginning, that helps Visual Studio Code understand what kind of file it is, and then will be available code autocomplete. As you see the file is untitled and cannot understand what h1 is.
Press Ctrl + S, choose the filename (should have css e
CSS rule is a selector and a property, separated by curly braces.
h1 is the selector and tells which HTML element will be affected. If you are new to HTML read this post.
Load a CSS file
If you want to load a CSS file so you can style an HTML file then you need to use the <link> tag. Let’s say you have this simple HTML file:
If you load this file on a Web Browser you will see:
Now load the css file:
<link rel="stylesheet" href="style.css">