Create a W3C XHTML 1.0 standard website

Source: Internet
Author: User
Xhtml1.0 is a modified version of html4.01 and is named xhtml1.0.
Xhtml1.0 has strict requirements, which is different from html4.01. The following 1-4 items are absolutely necessary and different from html4.01.
Use Dreamweaver MX 2004 to create web pages.
"Edit"-"preference settings"-"New File"-"set the file to XHTML compatible", and then add HTML to create the XHTML webpage.

The following lists some common errors:



, yes. The name of the "all" volume label element must be in lowercase. 2. All null tags that are not paired must end with/>,

and . This is a paired error:


input type = "text" name = "name"/>

3. Target = "_ blank" is not allowed"
You can use target = "_ blank" in html4.01 ",
However, xhtml1.0 is not allowed. You can rewrite it to target = "new"

4. All attributes must have values.
Xhtml1.0 specifies that all attributes must have a value. If not, the attribute must be repeated as a value.
Error <input type = "radio" value = "V1" Checked name = "S1"/>
Correct <input type = "radio" value = "V1" Checked = "checked" name = "S1"/>
Error <option selected> S1 </option>
Correct <option selected = "selected"> S1 </option>
Error <TD nowrap>
Correct <TD nowrap = "nowrap">

5. symbols not part of the volume label are encoded
The following symbols in the form must also be encoded.
<Expressed as <
> In & gt; format
& In & amp; format
ProgramAnd use & amp;
Error <a href = "foo. cgi? Chapter = 1 & Section = 2 ">
Correct <a href = "foo. cgi? Chapter = 1 & amp; Section = 2 ">

6. Common Errors using tables
We usually specify the width and height when creating a table. For example:
<Table border = "1" width = "300" Height = "55">
<Tr> <TD> content </TD> </tr>
There is no way to do this. W3C recommends that you use CSS to control the height of the label element.
. Table {
Height: 55px;
<Table class = "table">
<Tr> <TD> text </TD> </tr>
However, if too many tables are used, it is not a good method to specify different heights in CSS.
In fact, it is easy to specify the height attribute in the bucket to pass the test.
<Table border = "0" width = "300">
<Tr> <TD Height = "55"> text </TD> </tr>
However, this is not the W3C standard. We recommend that you use Div instead of unnecessary table.

7. correct use of the CSS style sheet
Must be placed between <LINK rel = "stylesheet" type = "text/CSS" href = "style.css"/>
<Style type = "text/CSS">
<! --
Body {font-size: 9pt ;}

Error <style>
Correct <style type = "text/CSS">
The sample code is written in the. CSS file.

8. The same ID selector cannot be used repeatedly.
The same selector of ID = "XX" in a Web page cannot be used repeatedly. If you need to use it again, use class = "XX"

9. Double quotation marks or single quotation marks must not be omitted.
Error style = font-size: 9pt
Correct style = "font-size: 9pt"
Error <a href = Home> text </a>
Correct <a href = "home"> text </a>

10. The tag must be a pair.
<P> </P>
<Span> </span>
<Div> </div>

11. Add a text note alt = "NOTE" to the image volume label"

12. Correct Marking order
Error <B> <I> text </B> </I>
Correct <B> <I> text </I> </B>

13. The annotated text cannot contain -- symbols
Error <! -- OEC--SPACE -->
Correct <! -- Oecspace -->

14. Javascript writing
Javascript is usually written
Error <script language = "JavaScript">
W3C standard must specify type = text/JavaScript For the program, so write
Correct <SCRIPT type = "text/JavaScript">
Or <script language = "JavaScript" type = "text/JavaScript">
Writing Method for loading external. js independent files
Correct <SCRIPT type = "text/JavaScript" src = "script. js"> </SCRIPT>

15. <embed> tag disputes
<Embed> is a private label of Netscape. W3C does not have this label from html3.2 HTML 4.01 to XHTML 1.0. Therefore, pages using <embed> cannot pass the standard test.
W3C recommends using the <Object> label and using the <Object>CodeIt can be written as follows:
<Object type = "application/X-Shockwave-flash" Data = "index.swf" width = "400" Height = "200">
<Param name = "movie" value = "index.swf"/>
However, this may cause problems in the ie5/IE6 win browser version. To enable standard display in any browser, the following connection nodes are provided for reference:
A list apart

<Embed> tags are widely used and no longer subject to standard disputes. To solve this problem, you can only wait for IE to better support <Object> or W3C to include <embed> tags.

16. The correct syntax for declaring XHTML 1.0 file categories (not lower case)
For general web pages
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 transitional // en"

Used for frame pages
<! Doctype HTML public "-// W3C // dtd xhtml 1.0 frameset // en"
W3C standard test web site
Web Automatic Test web Uri = Referer
During the test, the "16. File category announcement" and the specified file encoding must be included.
<Meta http-equiv = "Content-Type" content = "text/html; charset = big5"/>
In order to perform the test smoothly, start building a 10 thousand-dimensional standard website!

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: 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.