Home >Web Front-end >HTML Tutorial >Summary of seven basic specifications for XHTML coding_HTML/Xhtml_Web page production

Summary of seven basic specifications for XHTML coding_HTML/Xhtml_Web page production

WBOY
WBOYOriginal
2016-05-16 16:41:071360browse
1. All tags must have a corresponding closing tag
In the past, in HTML, you could open many tags, such as

and

  • without necessarily writing the corresponding and
  • to close them. But this is not legal in XHTML. XHTML requires a strict structure and all tags must be closed. If it is a separate unpaired tag, add a "/" at the end of the tag to close it. For example:

    Summary of seven basic specifications for XHTML coding_HTML/Xhtml_Web page production

    2. The names of all tag elements and attributes must be in lowercase
    Unlike HTML, XHTML is case-sensitive Sensitive, and <title> are different tags. XHTML requires that all tag and attribute names must be lowercase. For example: must be written as . Mixed case is also not recognized. Usually the attribute name "onMouseOver" automatically generated by Dreamweaver must also be changed to "onmouseover".

    3. All XHTML tags must be nested reasonably
    Also because XHTML requires a strict structure, all nesting must be in order, as we wrote before Code:

    /b> must be modified to:

    /p>
    That is to say, the nesting layer by layer must be strictly symmetrical .

    4. All attributes must be enclosed in quotation marks ""
    In HTML, you do not need to add quotation marks to attribute values, but in XHTML, they must be added quotation marks. For example:
    must be changed to:
    In special cases, you need to use double quotes in the attribute value, you can use ", single quotes can use ', for example:


    5. Encode all Any less than sign ( Any greater than sign (>), which is not part of the tag, must be encoded as >
    Any ampersand (&), which is not part of the entity, must be encoded as &a m p;
    Note: above There are no spaces between characters.

    6. Assign a value to all attributes
    XHTML stipulates that all attributes must have a value. If there is no value, it will repeat itself. For example:

    must be modified to:


    7. Do not use "–" in the comment content
    " –" can only occur at the beginning and end of XHTML comments, that is, they are no longer valid in the content. For example, the following code is invalid:

    Replace the inner ones with equal signs or spaces Dotted line.

    Some of the above specifications may look strange, but all of them are to make our code have a unified and unique standard to facilitate future data reuse.

    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