External css is written like "<link rel="stylesheet" type="text/css" href="a.css">", where href represents the css file that needs to be imported.
The operating environment of this article: Windows 7 system, Dell G3 computer, css3 version.
CSS (Cascading Style Sheets) is used to render styles for HTML element tags. CSS can be added to HTML in the following three ways: inline styles, nested styles, and external styles.
Outline style sheets are ideal when styles need to be applied to many pages. Using external style sheets, you can change the look of your entire site by changing one file.
Let’s take a look at how to write external css.
We can create a new text file, then change the file extension to .css, open this file and directly write the css style in the file. The method of opening css files can be seen here: How to open css suffix files?
When using external link styles, we need to introduce the tag in the
tag.<link rel="stylesheet" type="text/css" href="a.css">
href is the css file that needs to be introduced.
[Recommended learning: css video tutorial]
link tag:
The tag defines the relationship between the document and external resources. The most common use of the
tag is to link style sheets.
Differences between HTML and XHTML
In HTML, the tag does not have a closing tag.
In XHTML, the tag must be closed properly.
Tips and Notes:
Note: The link element is an empty element, it only contains attributes.
Note: This element can only exist in the head section, but it can appear any number of times.
The above is the detailed content of How to write external link css. For more information, please follow other related articles on the PHP Chinese website!