Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

XHTML Advice Needed 3

Status
Not open for further replies.

peacecodotnet

Programmer
May 17, 2004
123
US
I am starting a new web page that I will be fully releasing soon. I am not sure what I should do about XHTML. Do you think it's important for me to use it? If so, what steps should I take to make sure that all my documents are good XHTML?

Peace out,
Peace Co.
 

Using XHTML correctly will, if nothing else, give your source a more structured layout, and enable pages to be maintained more easily (and possibly ported more easily, too), IMHO.

You can validate your pages using the W3C's validator service, so it's fairly easy to check for compliance.

You also have different levels of compliance. Strict is what I aim for on all my pages, but despite the name, it's still fairly flexible in what you can do.

Hope this helps,
Dan


 
In an attempt to describe XHTML in a non-threatening manner... I would define it as HTML with some very simple rules:

* use lower case for all html (ie: <title> not <TITLE>)
* always close any tags that you have opened (ie. <div>..</div>)
* if there is no close tag, include one in the opening tag (ie. <hr> becomes <hr />, <img src="abc.gif" />)
* make sure you structure your html document correctly (ie. just one <body> tag)
* define a doctype at the start of your html (to tell browsers what they are to expect)

Of course there are lots of other things... but that covers a good 80% of the effort. If you build your html with those things in mind, you will not only have HTML compliance, but when you do "switch" to XHTML compliance, the effort will be minimal.

And as Dan mentions... it makes your code dead easy for others to maintain.

Jeff
 
To add an extra 10% to Jeff's effort:
[ul]
[li]Not only tag names but all attribute names must also be in lower case, e.g. <input type="text" name="lastname" value="Smith" />[/li]
[li]All attribute values must be in double quotes: <div class="menu"> instead of <div class=menu> or <div class='menu'>[/li]
[li]XHTML must be well structured: <a href=""><strong><i>Link</i></strong></a> instead of <a href=""><strong><i>Link</a></i></strong>[/li]
[li]Certain elements must have certain attributes (<img /> must have an alt="something" specified)[/li]
[/ul]
Like Dan said, W3 validator will help you with any problems you might have. Hope we haven't scared you.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top