Problems and experiences encountered in web development

Problems and experiences encountered in web development
<br />The following are the problems I encountered during development and the experiences I gained. It took me some time to debug, and I post them here to help others avoid detours.
1. XML files should be encoded in UTF-8 as much as possible. Some characters in GB2312 cannot be stored, such as ?. Even if they can be stored, they need to be converted, which is troublesome. UTF-8 also complies with international standards.
2. In CSS, the :hover pseudo-class will become invalid if placed before :visited.
3. If the <a> tag does not have an href attribute, all CSS pseudo-classes for it, such as :hover, will be invalid.

4. In the js file, the reference is in the form of document.wirte("<script language='javascript' src='" file "'></" "script>", and the file relative path is the path of the HTML that references the js.
For example: a.htm references x\b.js, b.js references x\c.js, then the file should be x\c.js instead of the direct path c.js relative to b.js. However, this problem does not exist in the @import and url() references in CSS. 5. In the page, sometimes the width of the talbe is set to 100%, which will leave a blank space on the right side of the scroll bar. Please set <body style="overflow:auto">
6. For commonly used images, do not use the img tag. Use <span><a> and use CSS to specify its background and width and height. For dynamic ones (changing the background when moving), it is best to use <a>. No additional code is required. Just use the pseudo-class :hover. The advantage of using CSS is that all changes can be made at once, which can be well used in skin-changing applications.
7. @font-face {font-family:comic;src:url(http://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. Some CSS
div { overflow: hidden; text-overflow: ellipsis; }
td { vertical-align : middle; }
To force overflow to occur and the ellipsis value to be applied, the author must set the object's white-space property to nowrap.
If there is no opportunity for line breaking (for example, the width of the object container is narrow, and there is a long text without reasonable line breaks), overflow is possible even without applying nowrap.
In order for the ellipsis value to be applied, this property must be set to an object that has an invisible area. The best option is to set the overflow property to hidden.
9. Firefox's document.createElement does not support HTML tags in the content, nor does it support innerText, but it supports innerHTML, and you can use innerHTML to specify its content.
10. The width of DropDownList in .net control is not colored in Firefox, you need to directly define style='width:10px;'
11. The CSS cursor in Firefox does not support hand, use pointer instead.

12. The scroll bar in the iframe needs to be set with style='overflow:hidden' in the iframe tag. It cannot be set only in the body, otherwise there will be problems in Firefox.
13. In the onpropertychange event, pay attention to using event.propertyName to filter the property change event. When setting this event, the onpropertychange property has actually been changed, so it will be automatically executed once.
14. The version of XSL supported in js5.6 is relatively low, such as the document function is not supported.

15. The slice function is slower than directly looping to get array fragments.
16. When nextSibling obtains the next object, it is important to note that there should be no space between the two nodes, otherwise it is easy to fail to obtain the correct object.
17. When there is Chinese in CreateTextFile, the third parameter must be specified as true, otherwise Chinese cannot be written, which will result in an error when Write is called.
18. Use ADODB.stream when saving Chinese text, not fso, because FSO does not support utf-8 format.

<<:  MySQL query method with multiple conditions

>>:  WeChat Mini Programs Implement Star Rating

Recommend

MySQL prepare principle detailed explanation

Benefits of Prepare The reason why Prepare SQL is...

Sample code using the element calendar component in Vue

First look at the effect diagram: The complete co...

How to change the dot in the WeChat applet swiper-dot into a slider

Table of contents background Target Effect Ideas ...

Detailed explanation of MySQL group sorting to find the top N

MySQL group sorting to find the top N Table Struc...

Share the 15 best HTML/CSS design and development frameworks

Professional web design is complex and time-consu...

Analysis of MySQL example DTID master-slave principle

Table of contents 1. Basic Concepts of GTID 2. GT...

Complete steps to implement location punch-in using MySQL spatial functions

Preface The project requirement is to determine w...

Solution to forgetting the root password of MySQL 5.7 and 8.0 database

Note: To crack the root password in MySQL5.7, you...

CSS implements Google Material Design text input box style (recommended)

Hello everyone, today I want to share with you ho...

Implementing a web player with JavaScript

Today I will share with you how to write a player...

Use iframe to display weather effects on web pages

CSS: Copy code The code is as follows: *{margin:0;...

javascript input image upload and preview, FileReader preview image

FileReader is an important API for front-end file...

How to update Ubuntu 20.04 LTS on Windows 10

April 23, 2020, Today, Ubuntu 20.04 on Windows al...

Vue routing returns the operation method of restoring page status

Route parameters, route navigation guards: retain...