3rd days of website construction using Web standards: definition language code
Developer on Alibaba Coud: Build your first app with APIs, SDKs, and tutorials on the Alibaba Cloud. Read more ＞
The third step is to define your language encoding, like this: <meta http-equiv = "Content-Type" content = "text/html; charset = gb2312 "/> to be correctly interpreted by the browser and validated by W3C code, all XHTML documents must declare the encoding language they use. We generally use gb2312 (simplified Chinese ), you can also use Unicode, ISO-8859-1, and so on to create a multi-language page, according to your needs.
Generally, this can be defined. However, the XML document does not define language encoding as follows:
<? XML version = "1.0" encoding = "gb2312"?>
You can see similar statements in the first line of Macromedia.com homepage code. This is also the definition method recommended by W3C. Why don't we use this method directly? The reason is that some browsers do not fully support the standard and cannot correctly understand such definition methods, such as IE6/windows. Therefore, we recommend that you use meta in the current transition scheme. Of course, you can write both methods.
Looking at the source code of this site, you will find that there is another sentence in the definition of language encoding:
<Meta http-equiv = "Content-Language" content = "gb2312"/>
This is intended for earlier browsers to ensure that all browsers can correctly interpret the page.
Note: At the end of the preceding statement, you can see a slash "/", which is different from the code written in HTML4.0. The reason is that the XHTML syntax rules require that all identifiers must start and end. Such as <body> and </body>, <p>, and </p>. For unpaired identifiers, a space must be added at the end of the identifiers, then follow "/". For example, <br> written as <br/> and written as . The reason for adding spaces is to prevent the code from being connected together and the browser does not recognize it.
This article is an English version of an article which is originally in the Chinese language on aliyun.com and is provided for information purposes only. This website makes no representation or warranty of any kind, either expressed or implied, as to the accuracy, completeness ownership or
reliability of the article or any translations thereof. If you have any concerns or complaints relating to the article, please send an email, providing a detailed description of the concern or
complaint, to firstname.lastname@example.org. A staff member will contact you within 5 working days. Once verified, infringing content will be removed immediately.
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:
and provide relevant evidence. A staff member will contact you within 5 working days.