Home > Web Front-end > HTML Tutorial > How to call external css in html

How to call external css in html

青灯夜游
Release: 2023-01-07 11:41:55
Original
13403 people have browsed it

Calling method: 1. Use the statement ""; 2. Use " @import url (CSS file path address)" statement call.

How to call external css in html

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

There are two ways for html to call external css

  • Link style--use the tag

  • Import type--Use the @import rule tag

1. Link type

In the < of the web page Use the tag in the /head> tag pair to introduce external style sheet files, and use html rules to introduce external css.

Syntax:

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

The tag defines the relationship between the document and external resources. The most common use of the tag is to link style sheets.

2. Imported

CSS @import rules are used to import style rules from other style sheets. These rules must precede all other types of rules, and @import cannot be used in rules of a conditional group.

Introduce an independent .css file into the HTML file, use the css @import rule to introduce the external css file, write it in the