Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to introduce js and css files

2025-01-17 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

Editor to share with you how to introduce js and css files. I hope you will get something after reading this article. Let's discuss it together.

External style sheet

External stylesheets are ideal when styles need to be applied to many pages. With an external stylesheet, you can change the appearance of the entire site by changing a file. Each page uses tags to link to the stylesheet. The tag is in the header (of the document):

one

two

three

The browser reads the style declaration from the file mystyle.css and formats the document based on it.

External style sheets can be edited in any text editor. The file cannot contain any html tags. Stylesheets should be saved with a .css extension.

Multiple style priority

Style sheets allow you to specify style information in a variety of ways. Styles can be specified in a single HTML element, in the header element of the HTML page, or in an external CSS file. You can even reference multiple external stylesheets within the same HTML document.

In general, the priorities are as follows:

Inline style) Inline style > (Internal style) Internal style sheet > (external style) External style sheet > browser default style

The script in HTML must be between the and tag.

Scripts can be placed in the and sections of the HTML page.

External JavaScript

You can also save the script to an external file. External files usually contain code used by multiple web pages.

The file extension of the external JavaScript file is .js.

To use an external file, set the .js file in the "src" attribute of the tag:

one

two

three

four

five

six

You can place the script in or, and the script in the tag runs exactly the same as the externally referenced script.

After reading this article, I believe you have a certain understanding of "how to introduce js and css documents". If you want to know more about it, you are welcome to follow the industry information channel. Thank you for reading!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report