Home  >  Article  >  Web Front-end  >  HTML optimization speeds up web pages_HTML/Xhtml_Web page production

HTML optimization speeds up web pages_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:44:551241browse
Clearly HTML, secretly using "common script"
The key to reducing web page download time is to find ways to reduce file size. When multiple pages share some component content, you can consider separating these common parts separately. For example: we can write a script used by multiple HTML pages into an independent .js file, and then call it in the page as follows:


This way, public files only need to be downloaded once and then go into the buffer. The next time the html page containing the public file is called again, the download time will be significantly reduced. Let stylesheet content work underground
CSS is an HTML decorator, and a beautiful web page cannot be without it. There are many ways to reference CSS in HTML pages, and different methods lead to different efficiencies. Usually, we can extract the style control code defined between , save it to a separate .css file, and then reference it in the HTML page using the
tag or @import tag:
Please note two points: 1. There is no need to include the tag in the .css file; 2. The @import and LINK tags must be defined in the HEAD section of the HTML page.

Two ways to save precious memory Minimizing the memory space occupied by HTML pages is an effective way to speed up page downloads. In this regard, there are 2 issues that need attention:

1. Use the same scripting language HTML pages are inseparable from the support of script programs. We often embed multiple script languages ​​​​in the page, such as JavaScript and VBScript. However, I wonder if you have noticed: this mixed use slows down the access speed of the page. The reason is: to interpret and run multiple script codes, multiple script engines must be loaded in memory. Therefore, please try to use the same scripting language to write code in the page.
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