In this article, we will learn how to link CSS to HTML. Linking CSS to HTML is a must for every size of the project. Resource linking is at the heart of HTML and CSS is a very important resource file.
Table of Contents
Also Read- Top 9 awesome form attributes in HTML
What is CSS?
CSS stands for Cascading style sheets. To give style to the HTML element we use CSS. CSS is a cornerstone for HTML.
How to link CSS to HTML?
Linking a CSS file to HTML is simple and easy. We use the
link tag to link the CSS file to HTML. The syntax is simple and provided below
<link rel="stylesheet" href="style.css" />
Here we used the
rel attribute to specify the relationship type. The relationship is
stylesheet. Next, we used the
href attribute to reference the CSS file location along with its name.
hrefstands for HyperText Reference.
We must put the
link tag in the
head tag of the HTML file. Like below
<html> <head> <link rel="stylesheet" href="style.css" /> </head> <body> </body> </html>
One more important thing to remember before linking the file. You must share this post with others.