Home >Web Front-end >CSS Tutorial >What is the use of external css style sheets?

What is the use of external css style sheets?

青灯夜游
青灯夜游Original
2021-11-02 17:54:313848browse

The functions of external css style sheets: 1. Separate styles from HTML, achieving complete separation of structure and performance code; 2. Convenient reuse and maintenance, reducing workload; 3. Reduce file size, Make the page structure easier to read by programmers and web crawlers; 4. Save network traffic and bandwidth; 5. Reduce rendering time; 6. Help search rankings, etc.

What is the use of external css style sheets?

The operating environment of this tutorial: Windows 7 system, CSS3 version, Dell G3 computer.

If the CSS style is placed in a file outside the web page document, it is called an external style sheet. A CSS style sheet document represents an external style sheet.

In fact, the external style sheet is a text file with the extension .css. When you copy the CSS style code into a text file and save it as a .css file, it is an external style sheet. For example, the following picture:

What is the use of external css style sheets?

The role of the external css style sheet:

  • Separates the style from the html, Complete separation of structure and performance code is achieved.

  • Convenient for reuse and maintenance, reducing workload. Because as long as the css style sheet file is modified, many web pages can be changed, and even the style and characteristics of the entire site can be changed. This avoids having to modify web pages one by one.

  • Because it is separated into separate files, the size of the HTML file is greatly reduced, making the page structure easier to read by programmers and web crawlers
  • Write The resulting code file is more concise (easier for others to read) and the file size is smaller.

  • Can save network traffic and bandwidth when transferring code files. (Because the file is smaller and repeated css styles will be stored in the cache)

  • When the code file is rendered, the rendering time can be reduced. (Because the file is smaller)

  • Friendly to search engines, allowing search engines to rate the page higher, which is beneficial to the page’s search engine ranking

  • The external style sheet is cached on the user's computer after the user's first visit, and there is no need to load it on the next visit

(Learning video sharing: css video tutorial)

The above is the detailed content of What is the use of external css style sheets?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
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