About external references to Css,js,jqurey

Source: Internet
Author: User

referencing text.css files

Starting with a reference to the CSS, the reference to the CSS has external references, internal references in two ways, but there are two other ways in the external reference, there are also two internal references.

External references have link references and @important references

Internal references (this is not strictly, just for better classification better to remember) can be used directly with style and directly nested two kinds.

We mainly talk about external references,

Link reference: in the head place <linkrel= "stylesheet" href= "Wcss.css" type= "Text/css"/> to invoke the external Wcss.css file to implement the HTML reference CSS file.

Advantages of using link to reference external CSS
1, in favor of SEO, using this method to reference external CSS files, will make the HTML page of the source code a lot less than directly add CSS style, because the search engine spider crawling Web page is not crawling CSS files, so that the HTML source code is very small, so that spiders crawl faster, less processing, Increase the weight of this page, in favor of ranking.
2, save the HTML to make the browser download Web page when separate threads, like loading a page at the same time there are two lines in the open a page truth, so that the page opened exceptionally fast. (The HTML source code and CSS file are downloaded at the same time when the user browses this webpage, making it faster)
3, modify the style of the page is convenient, just modify the CSS style can modify the page's art style, if in the site project this method, because the whole station has applied the common CSS basic style, so modify the whole station style according to Quick and convenient.

@important

    1. <style type="Text/css" Media="screen" >

    2. @import url ("CSS file");

    3. </style>

      Calling the Test.js file

You can save the pure JavaScript statement in a "*.js" file and call it again when needed.

Example: Call the Test.js file to display a hint.
<body>
<script language= "JavaScript" src= "Test.js" >
</script>
</body>

The path of reference JS can be placed in

Benefits of external loading of JavaScript files


    • Avoid <!-- ... //--> the use of hacker technology.

    • Avoid using CDATA.

    • Unified definition of JavaScript code, easy to view, easy to maintain.

    • Make your code more secure, and you can compress and encrypt a single JavaScript file.

    • Browsers can cache JavaScript files and reduce broadband usage (usually only one download at a time when multiple pages are using a single JavaScript file ).


Considerations for external loading of JavaScript files
    • Instead of dividing JavaScript into multiple files, multiple files increase the burden on the server and increase the server's HTTP requests.

    • A JavaScript file also increases the HTTP request.

Call Jqurey

There are two main ways to call Jqurey:

1. The first we can download can be used anytime, anywhere,

    • Production version-used in the actual website, this is a compact version.

    • Development version-for testing and development (uncompressed, readable code)

These two versions are available for download from the official website of jquery.com.

2. The second is online quoting, and now the most mainstream is Google's and Microsoft's CDN (Content distribution network) to reference it.

Google CDN:

Note: Use Google CDN to get the latest available version:

If you look at what Google URL is-Specify the JQuery version (1.8.0) in the URL. If you want to use the latest version of JQuery, you can also delete a number from the end of the version string (example 1.8), Google will return to the latest available version of the 1.8 series (1.8.0, 1.8.1, etc.), or the first number can be left, then Google will return 1 The latest available version in the series (from 1.1.0 to 1.9.9).

Mircrosoft CDN:

Note: Using Google or Microsoft's jQuery, there is a big advantage:

Many users have already loaded jQuery from Google or Microsoft while visiting other sites. All the results are that when they visit your site, JQuery is loaded from the cache, which reduces the load time. At the same time, most cdns ensure that when a user requests a file, the response is returned from the server closest to the user, which can also increase the load speed.




This article from the "10975329" blog, reproduced please contact the author!

About external references to Css,js,jqurey

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.