📄 xhtml_howto.asp@output=print
字号:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html lang="en-US" xml:lang="en-US" xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>XHTML HowTo</title>
<link rel="shortcut icon" href="../favicon.ico" type="image/x-icon" />
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
<meta name="Keywords" content="xml,tutorial,html,dhtml,css,xsl,xhtml,javascript,asp,ado,vbscript,dom,sql,colors,soap,php,authoring,programming,training,learning,beginner's guide,primer,lessons,school,howto,reference,examples,samples,source code,tags,demos,tips,links,FAQ,tag list,forms,frames,color table,w3c,cascading style sheets,active server pages,dynamic html,internet,database,development,Web building,Webmaster,html guide" />
<meta name="Description" content="Free HTML XHTML CSS JavaScript DHTML XML DOM XSL XSLT RSS AJAX ASP ADO PHP SQL tutorials, references, examples for web building." />
<meta http-equiv="pragma" content="no-cache" />
<meta http-equiv="cache-control" content="no-cache" />
<script type="text/javascript">
var gaJsHost = (("https:" == document.location.protocol) ? "../../https@ssl./default.htm" : "../../www./default.htm");
document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
</script>
<script type="text/javascript">
var pageTracker = _gat._getTracker("UA-3855518-1");
pageTracker._initData();
pageTracker._trackPageview();
</script>
</head>
<body>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
<h1>XHTML HowTo</h1>
<a href="xhtml_dtd.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="xhtml_validate.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<hr />
<h2>How W3Schools Was Converted To XHTML</h2>
<p>W3Schools was converted from HTML to XHTML the weekend of 18. and 19.
December 1999, by Hege Refsnes and St錶e Refsnes.</p>
<p>To convert a Web site from HTML to
XHTML, you should be familiar with the XHTML syntax rules of the previous
chapters. The following steps were executed
(in the order listed below):</p>
<hr />
<h2>A DOCTYPE Definition Was Added</h2>
<p>The following DOCTYPE declaration was added as the first line of every page:</p>
<table width="100%" border="1" class="ex" cellspacing="0">
<tr><td>
<pre><!DOCTYPE html PUBLIC
"-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"></pre></td></tr>
</table>
<p>Note that we used 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.</p>
<hr />
<h2>A Note About The DOCTYPE</h2>
<p>Your pages must have a DOCTYPE declaration if you want them to validate as
correct XHTML.</p>
<p>Be aware however, that newer browsers (like Internet Explorer 6) might treat
your document differently depending on the <!DOCTYPE> 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.</p>
<hr />
<h2> Lower Case Tag And Attribute Names</h2>
<p>Since 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 produce many real substitutions. </p>
<hr />
<h2>All Attributes Were Quoted</h2>
<p>Since 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. </p>
<hr />
<h2>Empty Tags: <hr> , <br> and <img></h2>
<p>Empty tags are not allowed in XHTML. The <hr> and <br> tags
should be replaced with <hr /> and <br />.</p>
<p>This produced a problem with Netscape that misinterpreted the <br/>
tag. We don't know why, but changing it to <br /> worked fine. After that
discovery, a general search and replace function was executed to swap the tags.</p>
<p>A few other tags (like the <img> tag) were suffering from the same problem as
above. We decided not to close the <img> tags with </img>, but with
/> at the end of the tag. This was done manually.</p>
<hr />
<h2>The Web Site Was Validated</h2>
<p>After that, all pages were validated against the official W3C DTD with this
link: <a href="../../validator.w3.org/check/referer" target="_blank">XHTML Validator</a>.
A few more errors were found and edited manually. The most common error was
missing </li> tags in lists.
</p>
<p>Should we have used a converting tool? Well, we could have used <b>TIDY</b>. </p>
<p> <a href="../../www.w3.org/People/Raggett/tidy/default.htm" target="_blank">Dave
Raggett's HTML TIDY</a> 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. </p>
<p>The reason why we didn't 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. </p>
<hr />
<a href="xhtml_dtd.asp"><img alt="previous" border="0" src="../images/btn_previous.gif" width="100" height="20" /></a>
<a href="xhtml_validate.asp"><img alt="next" border="0" src="../images/btn_next.gif" width="100" height="20" /></a>
<p>From <b>http://www.w3schools.com</b> (Copyright Refsnes Data)</p>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -