" tag and use the src attribute of the tag to introduce external js files. In the head tag of the web page, you can use the "" tag to introduce external css style sheet files; or use "@ import url("file path");" to introduce external css style files."/> " tag and use the src attribute of the tag to introduce external js files. In the head tag of the web page, you can use the "" tag to introduce external css style sheet files; or use "@ import url("file path");" to introduce external css style files.">
Home >Web Front-end >Front-end Q&A >How to introduce external JS files and CSS style files into web pages
In a web page, you can use the "3f1c4e4b6b16bbbd69b2ee476dc4f83a" tag and use the src attribute of the tag to introduce external js files. You can use the "2cdf5bf648cf2f33323966d7f58a7f3f" tag in the head tag of a web page to introduce an external css style sheet file; or use "@import url("file path");" to introduce an external css style sheet file.
The operating environment of this tutorial: windows7 system, JavaScript1.8.5&&css3 version, Dell G3 computer. This method is suitable for all brands of computers.
Recommended: javascript video tutorial, css video tutorial
Methods to introduce external JS files into web pages
You can introduce external js files through the src attribute of the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag.
Although the 3f1c4e4b6b16bbbd69b2ee476dc4f83a tag has many other attributes, these attributes are not commonly used, or they all have default values, and these default values usually do not need to be changed, so the src attribute may be the only one you need to know. properties.
<html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <title>JavaScript的引入</title> </head> <body> <!-- 引入本地文件 --> <script src="./script.js"></script> <!-- 引入外部域的文件 --> <script src="https://cdn.jsdelivr.net/npm/vue/dist/vue.js"></script> </body> </html>
This way the server will send the JavaScript file to the browser with the MIME type application/x-javascript.
Methods to introduce external CSS files into web pages
1. Introduce external css files through 2cdf5bf648cf2f33323966d7f58a7f3f
In the
The2cdf5bf648cf2f33323966d7f58a7f3f tag defines the relationship between the document and external resources. The most common use of the 2cdf5bf648cf2f33323966d7f58a7f3f tag is to link style sheets.
Syntax:
<link rel="stylesheet" href="css文件路径" type="text/css" />
2. Import css external files through import
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.
@import Rule Grammar
@import url("文件路径");
For more programming-related knowledge, please visit: Programming Course! !
The above is the detailed content of How to introduce external JS files and CSS style files into web pages. For more information, please follow other related articles on the PHP Chinese website!