Using Web standards to build a station day 6th: XHTML code Specification

Source: Internet
Author: User
Tags dashed line end lowercase requires valid
Web|web Standard |xhtml| specification before starting formal content production, we must first look at the specifications of the Web standards Code. Understanding these specifications can help you take fewer detours and pass code verification as soon as possible.

1. All tags must have a corresponding end tag
Previously in HTML, you could open a number of tags, such as

and

  • without necessarily writing the corresponding

    and
  • to close them. But this is not legal in XHTML. XHTML requires a rigorous structure, and all tags must be closed. If it is a single, unpaired label, add a "/" at the end of the label to close it. For example:


    2. All label elements and attributes must be named with lowercase
    Unlike HTML, XHTML is sensitive to case, and is a different label. XHTML requires that all labels and attribute names must be in lowercase. For example,: must be written in . Case-by-case inclusions are also not recognized, usually Dreamweaver automatically generated property names "OnMouseOver" must also be modified to "onMouseOver."

    3. All XML tags must be nested properly
    Also because XHTML requires a rigorous structure, all nesting must be in order, as previously written code:

    /b>
    Must be modified to:


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

    4. All attributes must be enclosed in quotation marks ""
    In HTML, you may not need to enclose attribute values in quotes, 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 value, which you can use ", single quotes", for example:


    5. Encode all < and & special symbols
    Any less than (<), which is not part of the label, must be encoded as & L T;
    Any greater-than sign (>), which is not part of the label, must be encoded as & G T;
    Any number (&), which is 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 stipulates that all attributes must have a value, and that no value repeats itself. For example:


    Must be modified to:


    7. Do not in the annotation content to make "--"
    "--" can only occur at the beginning and end of XHTML annotations, that is, they are no longer valid in the content. For example, the following code is not valid:


    Replaces the internal dashed line with an equal sign or a space.


    Some of these specifications look strange, but all of this is to make our code have a unified, unique standard for future data reuse.



    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.