Home > Article > Web Front-end > How does @import introduce CSS files? Is there any way
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>
style.css file code in the images folder:
@charset "utf-8"; /* php - www.php.cn */ .wai{ color:#F00}
The effect is as follows:
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!