Absrtact: The optimization of the website is divided into station optimization and outside station optimization, in which there are many aspects in the optimization of the station, and the optimization of the code is one of the main contents. Here are some common garbage code, I hope to help. Clean up the trash.
Site optimization is divided into station optimization and station optimization, in which there are many aspects of the optimization of the content, code optimization is one of the main content. Here are some common garbage code, I hope to help.
To clean up the garbage code is an important link to optimize the site. What is the spam code? Junk code is the unwanted code created by bad habits of programming software or programmers. Simply put, the deletion of junk Code has no effect on the page. Garbage code often occupies more than 80% of the total number of code, in order to let the site space burden, thereby enhancing the user experience, we need to code optimization.
The following are four common types of junk code:
1. Space characters
In the Web page code, each space is counted as a character, of course, the blank line is also a space. The existence of a large number of space characters, will greatly reduce the speed of the Web page completely open and increase the volume of the page, so we should delete the space character processing. We can use web-making software to clean up, while blank lines require manual cleanup.
2. Default Properties
When you use a Web page to make software, you will have the default property code generated. For example, when we don't add the "align Left" attribute to a called CSS, the page content is left-aligned, which means that the default code for "left-aligned" appears in the code. In this case, we can set up before using the software, you can also go to the later to troubleshoot.
3. Comment Statement
Some programmers often add a large number of annotation statements in order to better differentiate the functions of each piece of code when writing code. It's a good habit and it's not a good habit. Too many comment statements will take up a lot of web space. If there are a lot of relevant keywords in the comment statement, there is also the risk of being punished by search engines. Therefore, we should add as few comment statements as possible. If you add comments, you should also try to add less relevant keywords.
4. NULL statement
The cleanup of empty statements is often easily overlooked, as it is true that you do not see its presence. Empty statements are statements that do not have content between those tags. It takes up a lot of web space like a space character, so we should clean it up.
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.