search
HomeWeb Front-endHTML Tutorial16 Guidelines for XHTML1.0 and HTML Compatibility Summary_HTML/Xhtml_Web Page Production

1.Avoid declaring the page as XML type. The page uses UTF-8 or UTF-16 character set.

2.Add a slash / before the end character > of an empty element tag (a tag that cannot be used to contain content), such as:
,


etc.

3.When a non-empty element (this tag is used to contain content, such as a title, paragraph) is empty, give it a blank character instead of using the ending method like an empty element, for example: when a P tag has no content, please write:

instead of

.

4.When or two consecutive horizontal bars -- appear in your style and scripts content, please use external files to import them.

5.Avoid line breaks or multiple spaces in element attribute values.

6.Do not include more than one isindex element in the head part of the document (it is best not to use it). This element is not recommended.
isindex: Causes the browser to display a dialog box prompting the user to enter a single line of text.
In HTML 4, this element is deprecated and the INPUT element is recommended. The isIndex property of the tagName will return the input.
This element is a block element, and this element requires a closing tag.
The following example uses the ISINDEX element to replace the default prompt:

7.When you want to specify language for an element, please use the lang and xml:lang attributes . The value of xml:lang has higher priority.

8.Please use the id attribute as the element identifier and avoid using the name attribute . Especially on these elements, it is not recommended to use the name attribute as their identifier: a, applet, form, frame, iframe, img, map.

9.Define the document character set for the page , use to define the character set for the xml document, and define the character set for XHTML Use

10.Please use this attribute name for Boolean type element attribute values, such as: checked="checked", Boolean type elements include: compact, nowrap, ismap, declare, noshade, checked, disabled, readonly , multiple, selected, noresize, defer

11.HTML4 and XML Document Object Model specify that HTML element and attribute names return uppercase format. Element and attribute names in XHTML are returned in lowercase format.

12.Use & to replace the ampersand in attribute values ​​

13. In XHTML, the CSS style tag style and attribute names must use lowercase ;
In the HTML table, the tbody will be automatically completed during parsing, but this does not work in XML , so you need to add the tbody element yourself, if it is used in the CSS selector;
When CSS selects an element with an id attribute, use the #selector ;
When CSS selects an element with a class attribute, use the . selector ;

14. How to use the Style element when parsing XML documents? In HTML4 and XHTML, the style element can be used to define style rules in the document. In XML, the XML stylesheet is used to define style rules. In order to be compatible with this rule, If you need to use the style element when parsing the XML document, the style element You need to use the id attribute as the identifier, and there must be an XML stylesheet referencing it , such as:



br /> PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">


An internal stylesheet example




W3CGroup introduces 16 items for you Guidelines for XHTML and HTML compatibility!
http://www.w3cgroup.com/article.asp?id=252.




15.You need to pay attention to the white space character in HTML and XML. Some characters that are legal in HTML documents may not be legal in XML. For example, in HTML, the formfeed character (Formfeed character U 000C) is parsed as a space, but in XHTML, due to the character definition of XML, it become illegal.

16Pay attention to the special character ' (ellipsis, U 0027) It is introduced in XML1.0, but does not appear in HTML. Use ' to replace ' and it can be used in HTML4 use.

Statement
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
HTML, CSS, and JavaScript: Examples and Practical ApplicationsHTML, CSS, and JavaScript: Examples and Practical ApplicationsMay 09, 2025 am 12:01 AM

The roles of HTML, CSS and JavaScript in web development are: 1. HTML is used to build web page structure; 2. CSS is used to beautify the appearance of web pages; 3. JavaScript is used to achieve dynamic interaction. Through tags, styles and scripts, these three together build the core functions of modern web pages.

How do you set the lang attribute on the  tag? Why is this important?How do you set the lang attribute on the tag? Why is this important?May 08, 2025 am 12:03 AM

Setting the lang attributes of a tag is a key step in optimizing web accessibility and SEO. 1) Set the lang attribute in the tag, such as. 2) In multilingual content, set lang attributes for different language parts, such as. 3) Use language codes that comply with ISO639-1 standards, such as "en", "fr", "zh", etc. Correctly setting the lang attribute can improve the accessibility of web pages and search engine rankings.

What is the purpose of HTML attributes?What is the purpose of HTML attributes?May 07, 2025 am 12:01 AM

HTMLattributesareessentialforenhancingwebelements'functionalityandappearance.Theyaddinformationtodefinebehavior,appearance,andinteraction,makingwebsitesinteractive,responsive,andvisuallyappealing.Attributeslikesrc,href,class,type,anddisabledtransform

How do you create a list in HTML?How do you create a list in HTML?May 06, 2025 am 12:01 AM

TocreatealistinHTML,useforunorderedlistsandfororderedlists:1)Forunorderedlists,wrapitemsinanduseforeachitem,renderingasabulletedlist.2)Fororderedlists,useandfornumberedlists,customizablewiththetypeattributefordifferentnumberingstyles.

HTML in Action: Examples of Website StructureHTML in Action: Examples of Website StructureMay 05, 2025 am 12:03 AM

HTML is used to build websites with clear structure. 1) Use tags such as, and define the website structure. 2) Examples show the structure of blogs and e-commerce websites. 3) Avoid common mistakes such as incorrect label nesting. 4) Optimize performance by reducing HTTP requests and using semantic tags.

How do you insert an image into an HTML page?How do you insert an image into an HTML page?May 04, 2025 am 12:02 AM

ToinsertanimageintoanHTMLpage,usethetagwithsrcandaltattributes.1)UsealttextforaccessibilityandSEO.2)Implementsrcsetforresponsiveimages.3)Applylazyloadingwithloading="lazy"tooptimizeperformance.4)OptimizeimagesusingtoolslikeImageOptimtoreduc

HTML's Purpose: Enabling Web Browsers to Display ContentHTML's Purpose: Enabling Web Browsers to Display ContentMay 03, 2025 am 12:03 AM

The core purpose of HTML is to enable the browser to understand and display web content. 1. HTML defines the web page structure and content through tags, such as, to, etc. 2. HTML5 enhances multimedia support and introduces and tags. 3.HTML provides form elements to support user interaction. 4. Optimizing HTML code can improve web page performance, such as reducing HTTP requests and compressing HTML.

Why are HTML tags important for web development?Why are HTML tags important for web development?May 02, 2025 am 12:03 AM

HTMLtagsareessentialforwebdevelopmentastheystructureandenhancewebpages.1)Theydefinelayout,semantics,andinteractivity.2)SemantictagsimproveaccessibilityandSEO.3)Properuseoftagscanoptimizeperformanceandensurecross-browsercompatibility.

See all articles

Hot AI Tools

Undresser.AI Undress

Undresser.AI Undress

AI-powered app for creating realistic nude photos

AI Clothes Remover

AI Clothes Remover

Online AI tool for removing clothes from photos.

Undress AI Tool

Undress AI Tool

Undress images for free

Clothoff.io

Clothoff.io

AI clothes remover

Video Face Swap

Video Face Swap

Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

SecLists

SecLists

SecLists is the ultimate security tester's companion. It is a collection of various types of lists that are frequently used during security assessments, all in one place. SecLists helps make security testing more efficient and productive by conveniently providing all the lists a security tester might need. List types include usernames, passwords, URLs, fuzzing payloads, sensitive data patterns, web shells, and more. The tester can simply pull this repository onto a new test machine and he will have access to every type of list he needs.

PhpStorm Mac version

PhpStorm Mac version

The latest (2018.2.1) professional PHP integrated development tool

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

SublimeText3 Linux new version

SublimeText3 Linux new version

SublimeText3 Linux latest version