XHTML Standard Syntax _css/html

Source: Internet
Author: User
Tags closing tag compact lowercase

Writing XHTML requires the use of clean HTML syntax


--------------------------------------------------------------------------------

Some more XHTML Syntax Rules:
More XHTML Syntax rules:
Attribute names must be into lower case
Property name must be lowercase
Attribute values must be quoted
Use double quotes for property values
Attribute minimization is forbidden
The attribute shorthand is not allowed
The id attribute replaces the name attribute
Replace the Name property with the id attribute
The XHTML DTD defines mandatory elements
XHTML DTD defines mandatory elements

--------------------------------------------------------------------------------

Attribute Names must be into Lower case
Property name must be lowercase
This is wrong:
This is wrong:

<table width= "100%" >this is correct:
That's right:

<table width= "100%" >

--------------------------------------------------------------------------------

Attribute Values must be Quoted
attribute value must be enclosed with double quotes
This is wrong:
This is wrong:

<table Width=100%>this is correct:
That's right:

<table width= "100%" >

--------------------------------------------------------------------------------

Attribute minimization is forbidden
Attribute shorthand not allowed
This is wrong:
This is wrong:

<input checked>
<input readonly>
<input disabled>
<option selected>
<frame Noresize>this is correct:
The right thing to do:

<input checked= "Checked"/>
<input readonly= "ReadOnly"/>
<input disabled= "Disabled"/>
<option selected= "Selected"/>
<frame noresize= "Noresize"/>here is a list of the minimized attributes into HTML and how they should being written in XH TML:
This is an abbreviated attribute in HTML and a list of how it should be written in XHTML:

HTML XHTML
Compact compact= "compact"
Checked checked= "Checked"
DECLARE declare= "DECLARE"
ReadOnly readonly= "ReadOnly"
Disabled disabled= "Disabled"
Selected Selected= "Selected"
Defer defer= "defer"
Ismap ismap= "Ismap"
Nohref nohref= "Nohref"
NoShade noshade= "NoShade"
nowrap nowrap= "NoWrap"
Multiple multiple= "multiple"
Noresize noresize= "Noresize"


--------------------------------------------------------------------------------

The id attribute replaces the name attribute
ID attribute replaces the Name property
HTML 4.01 defines a name attribute for the elements a, applet, frame, iframe, IMG, and map. In XHTML, the name attribute is deprecated. Use ID instead.
For a, applets, frame, iframe, IMG, and map,html 4.01, a name attribute is defined, which is not supported in XHTML, and is substituted with an ID.

This is wrong:
This is wrong:

this is correct:
That's right:

note:to interoperate with older for ' a while ' browsers use should NA Me and ID, with identical attributes values, like this:
Note: For a lower-than-version browser, you should use the name and ID attributes at the same time, giving them the same value of two, like this:

important Compatibility Note:
Compatibility Note points:

To make your XHTML compatible with today's browsers, you should add a extra space before the "/" symbol.
Keep your XHTML compatible with your current browser you should add a space before the/tag


--------------------------------------------------------------------------------

The Lang Attribute
Lang Property
The lang attribute applies to almost every XHTML element. IT Specifies the language of the content within an element.
The lang attribute can be applied to almost any XHTML element. that specifies the language of the content in the element

If you use the "lang attribute," must add the Xml:lang attribute, like this:
If you apply the lang attribute to an element, you must add the Xml:lang attribute, like this:

<div lang= "No" xml:lang= "no" >heia norge!</div>

--------------------------------------------------------------------------------

Mandatory XHTML Elements
Enforcing XHTML elements
All XHTML documents must have a DOCTYPE declaration. The HTML, head and body elements must is present, and the title must is present the head element.
All XHTML documents must have a DOCTYPE reputation. The HTML, head, and body elements must appear and the title must be

This is a minimum XHTML document template:
This is a minimal XHTML document template

<! DOCTYPE DOCTYPE goes here>
<title>title goes here</title>
Body text goes
</body>Note: The DOCTYPE declaration is not part of the XHTML document itself. It is also not an XHTML element and it should not have a closing tag.

Note:the xmlns inside the Note: The XHTML document requires the xmlns attribute to appear in the HTML tag. However, the W3.org validator does not report an error because this attribute does not appear in your XHTML document. This is because "xmlns=http://www.w3.org/1999/xhtml" is a fixed value, and it is automatically added even if your document does not contain it.

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.