I. Waste code on the clean-up page。
The trash removal code refers to the removal of the redundant code from the page, which can remove 80 per cent of the redundant code。
The trash code refers primarily to those that are not necessary to remove or have any effect on the page. The most common trash code, spaces the space character is the most common garbage code in the web page. But it is not an indicator sign, but a symbol created by a code-editing environment, with each space being equivalent to one character, that is, 15 per cent of the page size of a page, 100k of a page, and 15k of a space character. Space characters most frequently appear at the beginning and end of the code, and there are empty lines. These are easy places to generate garbage code. The way to remove this type of garbage code is to select the code and then press the shift+tab key for left alignment。
Ii. HTML label handling
A: HTML label conversion
The conversion of HTML labels mainly refers to the replacement of long labels with short labels that have the same effect on a web page, such as five characters that are thicker than both. If there are hundreds of thick labels on one page. There will be a lot of redundant codes. The solution is to optimize the selection of labels for the HTML page。
B: head label
The website title
C: tags in the form of packagings such as tables, ur
When the browser compiler encounters a label, it begins to look for its end label, and it does not display its contents until it matches it, so when the labels in the form of a table, ur, etc., are so many, the page opens so slowly that it reduces the user experience. Solutions: in preparing HTML, try to keep a container as independent as possible and, if embedded, make it clear and brief。
D: photo ait tag
E: reasonable target = " blank"
The rational and non-frequent use of taget = " blank" is the ability to generate swing traffic and hits to some extent. At the same time, the use of target = " blank" in detail enhances the overall user experience of the website。
Iii. Optimization of css
A:css calls in three ways
1. Direct on page
And write between css styles, which do not affect much if the content is small, otherwise the size of the page is significantly increased and the top is also occupied。
2. Defines the csss style directly on the HTML label to increase the number of codes on the page。
3 quote external csss files, of which 3 is the best for seo optimisation
B: use of reset but not global reset
The default properties of the different browser elements vary, and some default attributes of the browser elements can be reset by restet to achieve the browser compatibility. But what needs to be noted is that instead of using global reset *margin:0; padding:0;} this is not only because it is a slow and inefficient method, but it also leads to unnecessary elements resetting outer and inner margins. Here, it is suggested to refer to yui reset and eric meyer:
Body, h1, h2, h3, h4, h5, h6, hr, p, blockquote, dd, dd, ol, li, pre, feldset, legend, button, input,
TExtarea, th, td, img {border: median none; margin: 0; padding: 0;}
Hey, hey, hey, hey, heyExtarea {font: 12px 'song ';}
H1, h2, h3, h4, h5, h6 {font-size: 100%;}
I'm sorry
Ul, ol {list-style: none;}
A {text-description: none; color:#333;}
A: cover {text-description: underline; color:#f40;}
Img{border:0px;}
+c:
Good naming habit
No doubt the code is a mess or no semantic name, and anyone would go crazy. Like
My name is wiky, the problem is if you need to change all the original red fonts to blue, then the style becomes red{color:bule;} it's hard to understand this name. It would be difficult to change the sidebar named leftbar to the right。
So please do not use the characteristics, colour, location, size, etc. Of the element to name a class or id. You can choose names of meaning such as #navigation{...}, . Sidebar{...}, . Postwrap{...}, so no matter how you modify the styles that define these class or ids, does not affect its connection to HTML elements。
There is also a situation in which the definition will not be modified by some fixed style, so you do not have to worry about the situation just described, such as:
I don't know?
. Alignleft{faat: left; margin-right: 20px;}
. Alignright{faat:right; text-align:right; margin-left: 20px;}
. Clear{clar:both; text-indent:-99999/px;} if you need to change this paragraph from the original left alignment to the right, then just change its classname to an alignright。
D: code abbreviations css code abbreviations can speed up your code writing and streamline your code volume。
There are a number of abbreviable properties in css, including margin, padding, border, font, background and colour values. If you learn code abbreviations, it can be coded:
L{font: 1. 2em/1. 4em ariel, helvetica, sans-serif; paddy: 5px 0 10px 5px;}
E: with css succession, if multiple sub-elements of parent elements in the page use the same style, it's best to make them the same
Styles are defined on their parent elements so that they inherit these css styles. So you can keep your code very well and reduce the number of codes. So that's the code
# co{font-family: georgia, serif;}
# co{font-family: georgia, serif;}
# co{font-family: georgia, serif;}
This can be written in:
I don't know?
#container
F: use multiple choosers
You can merge multiple css selectors for one if they have a common style. This is not only a simple code, but also saves you time and space。
E. G. H1, h2, h3 {font-family:ral, helvetica, sans-serif; font-weather:normal;}
G: appropriate code comment
The code note makes it easier for others to read your code, and it makes the structure clearer。
H: use external stylesheet
This principle has always been a good design practice. Not only is it easier to maintain changes, but more importantly, the use of external files increases the speed of pages, as css files can generate caches in browsers. The css that is embedded in the HTML document is redownsized with the HTML document in each request。
I: avoid css expression
The problem with the expression is that it is calculated more frequently than we thought. Recalculates not only when the page is displayed and scaled, but also when the page is scrolled and even when the mouse is moved. Adds a counter to the css expression to track the calculation frequency of the expression. You can easily reach more than 10,000 calculations by simply moving the mouse on a page。
J: code compression
When you decide to deploy the website project to the network, you will consider compressing the css, going out with comments and spaces to make the web page more quickly loaded. Compress your code by using tools such as yui compressor, which can streamline the css code to reduce file size to achieve higher load speed。
Iv. Js skills call
Two calls for js
A: write directly on the page, with a huge js code on the page not only increasing the size of the page, but also occupying a position as heavy as the first page. This prevents the relatively important position on the page from being displayed to the search engine on a priority basis。




