tag in the HTML
"/> tag in the HTML ">Home >Web Front-end >HTML Tutorial >How to reference external css files in html
How to reference external CSS files? Using the <link> tag, specify the rel="stylesheet" and href="CSS file path" attributes. Create an external CSS file Save the CSS file to the web server Use the <link> tag in HTML
How to reference in HTML External CSS files
It is easy to reference external CSS files in HTML, just use the <link>
tag.
Syntax:
<code class="html"><link rel="stylesheet" href="path/to/stylesheet.css"></code>
Steps:
.css
extension and styled according to CSS rules. <link>
tag in the HTML code: Add <link> in the
section
tag, specify the rel="stylesheet"
and href="path/to/stylesheet.css"
attributes. href
The value of the property should be the path to the CSS file. Example:
<code class="html"><!DOCTYPE html> <html> <head> <link rel="stylesheet" href="mystyles.css"> </head> <body> <h1>标题</h1> <p>段落</p> </body> </html></code>
Benefits:
Using external CSS files has the following benefits:
The above is the detailed content of How to reference external css files in html. For more information, please follow other related articles on the PHP Chinese website!