Home Web Front-end HTML Tutorial 16 Guidelines for XHTML1.0 and HTML Compatibility Summary_HTML/Xhtml_Web Page Production

16 Guidelines for XHTML1.0 and HTML Compatibility Summary_HTML/Xhtml_Web Page Production

May 16, 2016 pm 04:42 PM
html compatible

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:



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.



< /html>


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 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

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

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

Hot Topics

Java Tutorial
1663
14
PHP Tutorial
1266
29
C# Tutorial
1237
24
Table Border in HTML Table Border in HTML Sep 04, 2024 pm 04:49 PM

Guide to Table Border in HTML. Here we discuss multiple ways for defining table-border with examples of the Table Border in HTML.

Nested Table in HTML Nested Table in HTML Sep 04, 2024 pm 04:49 PM

This is a guide to Nested Table in HTML. Here we discuss how to create a table within the table along with the respective examples.

HTML margin-left HTML margin-left Sep 04, 2024 pm 04:48 PM

Guide to HTML margin-left. Here we discuss a brief overview on HTML margin-left and its Examples along with its Code Implementation.

HTML Table Layout HTML Table Layout Sep 04, 2024 pm 04:54 PM

Guide to HTML Table Layout. Here we discuss the Values of HTML Table Layout along with the examples and outputs n detail.

HTML Input Placeholder HTML Input Placeholder Sep 04, 2024 pm 04:54 PM

Guide to HTML Input Placeholder. Here we discuss the Examples of HTML Input Placeholder along with the codes and outputs.

How do you parse and process HTML/XML in PHP? How do you parse and process HTML/XML in PHP? Feb 07, 2025 am 11:57 AM

This tutorial demonstrates how to efficiently process XML documents using PHP. XML (eXtensible Markup Language) is a versatile text-based markup language designed for both human readability and machine parsing. It's commonly used for data storage an

HTML Ordered List HTML Ordered List Sep 04, 2024 pm 04:43 PM

Guide to the HTML Ordered List. Here we also discuss introduction of HTML Ordered list and types along with their example respectively

HTML onclick Button HTML onclick Button Sep 04, 2024 pm 04:49 PM

Guide to HTML onclick Button. Here we discuss their introduction, working, examples and onclick Event in various events respectively.

See all articles