Day 6th: XHTML Code Specification _ Basic Tutorial

Source: Internet
Author: User
Tags closing tag dashed line
Before we begin our formal content production, we must first look at the specifications of the Web standards Code. Understanding these specifications can help you to take fewer detours and pass code validation as soon as possible.

1. All marks must have a corresponding closing tag

Previously in HTML, you could open many tags, such as

And

  • And not necessarily write the corresponding

    And

  • To close them. But it's not legal in XHTML. XHTML requires a rigorous structure, and all tags must be closed. If the label is not paired individually, close it by adding a "/" to the label at the end. For example:


    2. The names of all the elements and attributes of the tag must be in lowercase

    Unlike HTML, XHTML is case-sensitive,Andis a different label. XHTML requires that all labels and attribute names must be lowercase. For example:Must be written. Uppercase and lowercase inclusions are also not recognized, and typically Dreamweaver automatically generates attribute names "OnMouseOver" that must also be modified to "OnMouseOver".

    3. All XML tags must be properly nested

    Also because XHTML requires a rigorous structure, all of the nesting must be in order, as we have previously written code:

    /b>

    Must be modified to:

    /p>

    That is, a layer of nesting must be strictly symmetric.

    4. All attributes must be enclosed in quotation marks ""

    In HTML, you don't need to quote attribute values, but in XHTML they must be quoted. For example:

    Must be modified to:

    In special cases, you need to use double quotes in the attribute values, you can use ", single quotes can be used," for example:

    5. To encode all the special symbols of the h3>

    • any less than (<), not part of the label, must be encoded as & l t;
    • any greater than sign (>), not part of the label, must be encoded as & g T;
    • any number (&), not part of the entity, must be encoded as & a M p;

    Note: There are no spaces between the above characters.

    6. Assign a value to all properties

    XHTML Specifies that all properties must have a value, and that no value repeats itself. Example:

    must be modified to:

    7. Do not make"--"

    "--"in the comment content only at the beginning and end of the XHTML annotations, that is, they are no longer valid in the content. For example, the following code is invalid:

    !--here is the comment-----------here is the comment-->

    Replace the inner dashed line with an equal sign or a space.

    !--here is the comment ============ here is the comment-->

    Above these specifications some look strange, but all of this is to make our code have a uniform, unique standard, convenient for the next few Use it again.

  • Related Article

    Contact Us

    The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

    If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

    A Free Trial That Lets You Build Big!

    Start building with 50+ products and up to 12 months usage for Elastic Compute Service

    • Sales Support

      1 on 1 presale consultation

    • After-Sales Support

      24/7 Technical Support 6 Free Tickets per Quarter Faster Response

    • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.