How to XHTML 1.0

หลักการทำงานของไฟล์ XHTML 1.0 

• มีการกำหนด DOCTYPE ที่เหมาะสมกับเอกสาร แบ่งเป็นแบบเข้มงวด, แบบยืดหยุ่น, และแบบเฟรม 

<!DOCTYPE html      PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<!DOCTYPE html      PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<!DOCTYPE html      PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN"      "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd"> 

• มีการใช้ <tag></tag> ที่มีการจัดวางตำแหน่งที่ถูกต้อง 

<p>here is an emphasized <em>paragraph</em>.</p> 

• ต้องใช้ตัวหนังสือแบบเล็กเสมอ 

<p></p> 

• จะต้องมี <tag> ปิดเสมอ 

<p>here is a paragraph.</p> <p>here is another paragraph.</p> <br /> <hr /> 

• ค่าของ attribute ต่างๆ ใน <tag> จะต้องอยู่ในเครื่องหมายคำพูด "..." 

<td rowspan="3"></td> 

• จะต้องใช้คำขยาย attribute แบบเต็ม ไม่ให้ใช้แบบย่อ 

<dl compact="compact"></dl> <option selected="selected"></option> <input type="radio" checked="checked" /> 

• ให้ใช้ attributes ชนิด id แทน name 

<a href="#foo">...</a> <a id="foo" name="foo">...</a>