Eighteen tips for making web pages about code

Time:2019-5-12

1. XML files are encoded as UTF-8 as far as possible. Some words of GB2312 can not be stored, such as?, even if they can be stored, they need to be converted, which is troublesome. UTF-8 also conforms to international standards.
2. In CSS, the pseudo-Class hover will fail if it is placed before visited.
3. <a> Label without href attribute will invalidate all pseudo-classes of its css, such as hover.
4. References in the form of document. wirte (“<script language=’javascript’src='” file “‘> </””script>) are used in JS files. The relative paths of files are all HTML paths that refer to the js.
For example: a.htm refers to x b.js, B.js refers to x c.js, and B.js refers to x c.js, then file should be x c.js instead of c.js, the direct path relative to b.js, while the @import, URL () reference in CSS does not have this problem.
5. In the page, sometimes the width of talbe is set to 100% and a blank scrollbar is left on the right side. Please set < body style= “overflow: auto”>
6. Don’t use img tags for commonly used pictures, use < span > < a > and specify its background and width with css. For dynamic (moving up and changing background), use < a > is the best, and no extra code is needed. Just use pseudo class: hover, the advantage of using CSS is to change all at once, which can be well used in skin-changing applications.
  7、@font-face {font-family:comic;src:url(https://valid_url/some_font_file.eot);}
Define a font name that is not available locally and call <span style=”font-family:comic; font-size:18pt>aa</span>
8. Several CSS
  div { overflow: hidden;text-overflow:ellipsis; }
  td { vertical-align : middle; }
[u] To force an overflow to occur and apply the ellipsis value, the author must set the white-space attribute value of the object to nowrap. [/u] Without the opportunity to change lines (e.g., the width of the object container is narrow and there are long unreasonable broken lines in it), it is possible to overflow without applying nowrap.
In order for ellipsis values to be applied, this property must be set to an object with an invisible region. The best option is to set the overflow property to hidden.
9. Firefox’s document. createElement does not support HTML tags in content, nor innerText, but it supports innerHTML and can specify its content with innerHTML.
The width of DropDownList in the. net control is not colored under firefox, so we need to define style=’width:10px directly.
11. Cursor of CSS in Firefox does not support hand, instead of pointer.
12. Scroll bars in iframe need to set style =’overflow: hidden’in the iframe tag, not just in the body, but in firefox.
13. In onpropertychange event, pay attention to using event. propertyName to filter the event of attribute change. When setting this event, the attribute of onpropertychange has been changed, so it will be automatically executed once.
The XSL support versions in 14 and js5.6 are relatively low, such as the document function.
15. The slice function is slower than the direct loop to obtain array fragments.
16. When NextSibling obtains the next object, it should be noted that there is no space between the two nodes, otherwise it is easy to get the correct object.
17. CreateTextFile must specify the third parameter to be true when it has Chinese, otherwise it can not be written to Chinese, as Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write Write
18. ADODB.stream is used to save Chinese text and FSO is not used because FSO does not support UTF-8 format.

Recommended Today

Detailed explanation of how to customize redis command with Lua

preface As a very successful database, redis provides a wealth of data types and commands. Using these, we can easily and efficiently complete many cache operations, but there are always some special problems or needs to be solved. At this time, we may need to customize our own redis data structure and commands. Redis command […]