[XHTML TUTORIAL] Trend XHTML Standard (6) (XHTML HOWTO)

xiaoxiao2021-03-06  42

Original address: http://www.w3schools.com/xhtml/xhtml_howto.asp Translation: Fan Weixiax XHTML HOWTO How to convert my existing website into XHTML? TO Convert A Web Site from Html To XHTML, You Should Be Familiar With the xhtml syntax rules of the previous chapters. THE ORDER LISTED BERE EXECUTED: Convert an HTML website to XHTML, you should be familiar with the XHTML's grammar rules introduced in the previous chapter. The following will help you.

A DoctyPe Definition Was Addedthe Following DOCTYPE DECLATION WAS ADED As The First Line of Every Page: The following line code is added to the first line of each page.

Note That We buy The Transitional DTD. We Could Have Chosen The Strictt DTD, But Found It A little Too "strict", and a little too hard to conform to. Note, here we use Transstitional DTD. Of course, we can also choose Strict DTD, but we found that it is a bit too strict, and it is too difficult to follow it.

A Note About The DoctypeYour Pages Must Have a doctype Declaration if You Want the To Validate As Correct XHTML. If you want your page to meet the correct XHTML validity You must use the DOCTYPE statement. Be aware however, that newer browsers (like Internet Explorer 6) might treat your document differently depending on the declaration. If the browser reads a document with a DOCTYPE, it might treat the document as "correct". Malformed XHTML might Fall over and display DIFFERENTLY THAN WITHOUT A DOCTYPE. However, you must notice that there will be different treatments after comparing new browsers (like IE6). If the browser reads a page containing the DOCTYPE declaration, it may assume this page "correct." If you do not use the DOCTYPE, the XHTML page may cause the above element to "drop" and display the first a different page. Lower Case Tag And Attribute NamesSince XHTML is case sensitive, and since XHTML only accepts lower case HTML tags and attribute names, a general search and replace function was executed to replace all upper case tags with lowercase tags. The same was done for attribute names. We have always Tried to Use Lower Case Names IN Our Web, So The Replace Function Did Not Product Many Replace Function Did Not Product Many Replace Function Did Not Product Many Real Substitutions. XHTML is sensitive and only accepts lowercase tags and properties, you can use the replacement. All Attributes Were QuotedSince the W3C XHTML 1.0 Recommendation states that all attribute values ​​must be quoted, every page in the web was checked to see that attributes values ​​were properly quoted. This was a time-consuming job, and we will surely never again forget to Put Quotes Around Our Attribute Values. This is to be causing parentheses. This is not a simple way, but it is a work of time, just remember that you will not forget the brackets. Empty Tags:


, EMPTY TAGS Are Not Allowed in XHTML. The
and
tags shop be replaced with
and
.

This produced a problem with Netscape that misinterpreted the
tags. We do not know why, but changing it to
worked fine. After that discovery, a general search and replace function was executed to swap the tags.

A few other tags (Like the tag) WERE SUFFERING from the Same Problem as Above. We Decided Not to Close The tags with , but with /> at the end of the tag. This WAS Done Manually. Too much. That thing about the mark The Web Site Was ValidatedAfter that, all pages were validated against the official W3C DTD this link with:.. XHTML Validator A few more errors were found and edited manually The most common error was missing tags in Lists. Your website can be verified by the official XHTML validity inspector, more errors will be checked and hand-made, and the most common error is to forget writing in List. Should we have used a converting tool? Well, we could have used TIDY. You can use TIDY this conversion tool Dave Raggett's HTML TIDY is a free utility for cleaning up HTML code. It also works great on the hard-to-read markup generated by specialized HTML editors and conversion tools, and it can help you identify where you need to pay further attention on making your pages more accessible to people with disabilities. Dave Raggett's HTML TIDY is a free software used to optimize the HTML code, it can also be very Good deal with the difficult-to-understand tags generated by a special HTML editor and conversion tool, while it can help you identify if you must pay attention to your page from a long angle? The reason why we did not use Tidy? We knew about XHTML when we started writing this web site. We knew that we had to use lowercase tag names and that we had to quote our attributes. So when the time came (to do the Conversion), WE Simply Had to Test Our Pages Against The W3C XHTML Validator and Correct The Few Mistakes. And - We Have Learned A Lot About Writing "Tidy" HTML Code. We don't use Tidy because we do this website We know XHTML, lowercase and quotation marks we also know. So when we need to convert, we just simply correct our minority errors through the W3C's XHTML validator. Also, we have already understood the clean HTML code to write clean.

A DoctyPe Definition Was Addedthe Following DOCTYPE DECLATION WAS ADED As The First Line of Every Page: The following line code is added to the first line of each page. Note That We buy the transitional DTD. We Could Have Chosen The Strict DTD, But Found It A little Too "strict", and a little too hard to conform to. Note, here we use the Transstitional DTD. Of course, we can also choose Strict DTD, but we found that it is a bit too strict, and it is too difficult to follow it.

A Note About The DoctypeYour Pages Must Have a doctype Declaration if You Want the To Validate As Correct XHTML. If you want your page to meet the correct XHTML validity You must use the DOCTYPE statement. Be aware however, that newer browsers (like Internet Explorer 6) might treat your document differently depending on the declaration. If the browser reads a document with a DOCTYPE, it might treat the document as "correct". Malformed XHTML might Fall over and display DIFFERENTLY THAN WITHOUT A DOCTYPE. However, you must notice that there will be different treatments after comparing new browsers (like IE6). If the browser reads a page containing the DOCTYPE declaration, it may assume this page "correct." If you do not use the DOCTYPE, the XHTML page may cause the above element to "drop" and display the first a different page. Lower Case Tag And Attribute NamesSince XHTML is case sensitive, and since XHTML only accepts lower case HTML tags and attribute names, a general search and replace function was executed to replace all upper case tags with lowercase tags. The same was done for attribute names. We have always Tried to Use Lower Case Names IN Our Web, So The Replace Function Did Not Product Many Replace Function Did Not Product Many Replace Function Did Not Product Many Real Substitutions. XHTML is sensitive and only accepts lowercase tags and properties, you can use the replacement. All Attributes Were QuotedSince the W3C XHTML 1.0 Recommendation states that all attribute values ​​must be quoted, every page in the web was checked to see that attributes values ​​were properly quoted. This was a time-consuming job, and we will surely never again forget to Put Quotes Around Our Attribute Values. This is to be causing parentheses. This is not a simple way, but it is a work of time, just remember that you will not forget the brackets. Empty Tags:


, EMPTY TAGS Are Not Allowed in XHTML. The
and
tags shop be replaced with
and
.

This produced a problem with Netscape that misinterpreted the
tags. We do not know why, but changing it to
worked fine. After that discovery, a general search and replace function was executed to swap the tags.

转载请注明原文地址:https://www.9cbs.com/read-73024.html

New Post(0)