Home > Article > Web Front-end > How to link html to css
In web design, style sheets are a very important part, which can make our web pages more beautiful and easier to read. HTML can link to external style sheets, and the most commonly used style sheet is CSS. In this article, we will introduce how HTML links to CSS.
1. What is CSS?
CSS (Cascading Style Sheets) is a markup language used to describe the appearance style of documents such as HTML or XML. CSS can separate the appearance and format of a web page from its content by controlling fonts, colors, backgrounds, layout, etc.
2. Link CSS in HTML
To use CSS in HTML, we need to add the element in the
tag. This element is used to link to external CSS files. In the element, we can specify the location, file name, and media type of the CSS file. Here is an example:<head> <link rel="stylesheet" type="text/css" href="styles.css"> </head>
In this example, we name the CSS file "styles.css" through the element, which is located in the directory of our current web page. This CSS file contains the styles we want to apply to the page.
When the browser parses HTML, it automatically downloads the CSS file and applies the styles in it to the HTML.
3. Internal CSS style sheet
In addition to linking external CSS files, we can also add the