Home > Web Front-end > CSS Tutorial > How does @import introduce CSS files? Is there any way

How does @import introduce CSS files? Is there any way

云罗郡主
Release: 2018-11-22 16:53:05
forward
5372 people have browsed it

The content of this article is about how @import introduces CSS files? Is there any method that has certain reference value? Friends in need can refer to it. I hope it will be helpful to you.

@import introduces CSS style sheet files

@import url (url) sMedia;

Description:

url: Use absolute or relative address to specify the import external style sheet file. It is equivalent to link introducing CSS files. (Learn the difference between link and @import and how to choose)

css @import uses two commonly used methods

The first one: the html source code (in the html file) directly introduces the external style sheet CSS file

html file index.html code:

<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>import使用实例</title>
<style>
@import url(images/style.css);
</style>
</head>
<body>
<span class="wai">实例测试内容</span>
</body>
</html>
Copy after login

style.css file code in the images folder:

@charset "utf-8";
/* php - m.sbmmt.com */
.wai{ color:#F00}
Copy after login

The effect is as follows:

How does @import introduce CSS files? Is there any way

As you can see above, using @import in HTML code requires the use of style tags.

Summary: To directly use @import to introduce external CSS style sheet files in the HTML source code, you need to put @import into the

Second: Use @import in the CSS file code to introduce another CSS file

In addition to using the style tag to use @import in the HTML source code, @ can still be used in the CSS file code. import, there is no need for the style tag at this time, but just use @import directly, so that one (multiple) CSS files can be introduced into another (multiple) CSS files.

The above is how @import introduces CSS files? All methods are introduced. If you want to know more about CSS3 tutorials, please pay attention to the PHP Chinese website.


The above is the detailed content of How does @import introduce CSS files? Is there any way. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:thinkcss.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template