When you're creating a web page, one of the easiest ways to create a lean and clean set of xhtml code is to begin with your "doctype". The doctype declares to the reading browser (the browser you are using to view your pages) what to expect and how to interpret it. So, if you don't tell the browser anything at all, it reads everything in what is called "quirks" mode, which may or may not display your pages as intended. Bottom line - always use a doctype. And why xhtml? Because it is where everything is going or has gone. There are some basics you should know about xhtml, so you may wish to visit the
w3schools site, which will provide you with all and more than you ever wanted to know about xhtml, css, and html.
I typically use the transitional form of the doctype, as follows:
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
For more information on choosing a doctype, follow the links below:
http://www.htmlhelp.com/tools/validator/doctype.html
http://www.w3.org/QA/2002/04/valid-dtd-list.html
After choosing a doctype, open your favorite text editor and insert it as the first line. Be sure you are not using an editor that may insert its own code after saving the file and when you do save the file, choose "save as..." and create a name of your choosing and extend it with .html, i.e.,
your_filename.html.
No comments:
Post a Comment