Home > Web Front-end > HTML Tutorial > Building a Website Using Web Standards Day 3: Defining Language Encoding

Building a Website Using Web Standards Day 3: Defining Language Encoding

黄舟
Release: 2016-12-19 15:11:38
Original
1005 people have browsed it

The third step is to define your language encoding, similar to this:

In order to be correctly interpreted by the browser To pass W3C code verification, all XHTML documents must declare the encoding language they use. We generally use gb2312 (Simplified Chinese). It is also possible to use Unicode, ISO-8859-1, etc. to create multi-language pages, depending on your needs. definition.


Usually this definition is enough. But it should be added that the XML document does not define language encoding in this way. XML is defined as follows:


You can see a similar statement in the first line of code on the home page of Macromedia.com. This is also the definition method recommended by the W3C. So why don’t we just adopt this approach? The reason is that some browsers have incomplete support for standards and cannot correctly understand such definition methods, such as IE6/windows. Therefore, under the current transition plan, we still recommend using the meta method. Of course, you can write both ways.

Looking at the source code of this website, you will find that there is one more sentence where the language encoding is defined:


 This It is written for older browsers to ensure that various browsers can correctly interpret the page.

Note: At the end of the above declaration statement, you see a slash "/", which is different from our previous HTML4.0 code writing. The reason is that XHTML syntax rules require that all tags must have a beginning and an end. For example, and ,

and

, etc. For unpaired identifiers, it is required to add a space at the end of the identifier, followed by a "/". For example,
is written as
, and is written as . The reason for adding spaces is to prevent the browser from not recognizing the codes together.

The above is the third day of building a website using Web standards: defining the content of language encoding. For more related content, please pay attention to the PHP Chinese website (www.php.cn)!


Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template