The third step is to define your language encoding, something like this:
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
In order to be correctly interpreted by browsers and 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 and ISO-8859-1 to create multi-language pages. etc., define according to your needs.
Usually this definition suffices. However, it should be added that XML documents do not define language encoding in this way. XML is defined as follows:
<?xml version="1.0" encoding="gb2312"?>
You can see similar statements in the first line of code on the homepage 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:
<meta http-equiv="Content-Language" content="gb2312" />
This is written for older browsers to ensure that various browsers can interpret the page correctly.
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, <body> and </body>, <p> and </p>, etc. For unpaired tags, it is required to add a space at the end of the tag, followed by a "/". For example, <br> is written as <br />, and <img> is written as <img />. The reason for adding spaces is to prevent the browser from recognizing the codes when they are connected together.