XHTML Tutorial: XHTML basics for beginners 3

Source: Internet
Author: User

XHTML syntax


To put it simply, you must use clean HTML syntax to write XHTML.

Some other syntax requirements of XHTML:


The property name must be in lowercase. For example:

Error code:

& Lt; table WIDTH = "100%" & gt;

Correct code:

& Lt; table width = "100%" & gt;

 

The property value must be referenced. For example:


Error code:


<Table width = 100%>


Correct code:

 

& Lt; table width = "100%" & gt;

The abbreviation of the attribute is forbidden. For example:

Error code:


<Dl compact>


<Input checked>


<Input readonly>


<Input disabled>

<Option selected>

<Frame noresize>

 

Correct code:

 

<Dl compact = "compact">

<Input checked = "checked"/>

<Input readonly = "readonly"/>

<Input disabled = "disabled"/>

 

<Option selected = "selected"/>


<Frame noresize = "noresize"/>


List a table to let everyone know:


HTML XHTML

Compact = "compact"

Checked = "checked"

 

Declare = "declare"

 

Readonly = "readonly"


Disabled = "disabled"

 

Selected = "selected"

Defer = "defer"

Ismap = "ismap"

 

Nohref = "nohref"


Noshade = "noshade"

Nowrap = "nowrap"

Multiple = "multiple"

Noresize = "noresize"

Replace the name attribute with the id attribute. For example:


In HTML 4.01, a name attribute is defined for a, applet, frame, iframe, img, and map. In XHTML, the name attribute cannot be used and should be replaced by id. For example:

Error code:


Correct code:

Note: In order to make the old browser execute the content normally, we can also use the id and name attributes in the tag. For example:


In order to adapt to the new browser browsing, we added the/tag in the above code to end.

 

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.