Home > Web Front-end > Front-end Q&A > What are the forms of css external links?

What are the forms of css external links?

青灯夜游
Release: 2022-07-27 20:27:31
Original
5939 people have browsed it

There are two forms of css external links: 1. Link the css external style to the HTML page through the link tag. The link tag needs to be placed in the head tag area, and the syntax is ""; 2. Link through the "@import" rule in the style tag, with the syntax "@import url("css file path");".

What are the forms of css external links?

The operating environment of this tutorial: Windows 7 system, CSS3&&HTML5 version, Dell G3 computer.

If the CSS style is placed in a file outside the web page document, it is called an external style sheet. A CSS style sheet document represents an external style sheet.

In fact, the external style sheet is a text file with the extension .css. When you copy the CSS style code into a text file and save it as a .css file, it is an external style sheet.

As shown below, it is an external style sheet:

What are the forms of css external links?

So how to link the css external style sheet to the HTML document? There are two ways to use external style sheets:

1), using link

The link style refers to defining the CSS style sheet externally and forming it as .CSS file extension, and then link to the page through the <link> link tag in the page, and the link statement must be placed in the

tag area of ​​the page.

Syntax:

<link type="text/css" rel="styleSheet"  href="CSS文件路径" />
Copy after login

2), use @import

Import is through @import in