Web SiteBilder How To's
  Web
Tutorials
 
   


Secured by RapidSSL










1 XHTML Intro XHTML Attributes:

Last of all, we will delve into the changes to HTML attributes in XHTML. The XHTML attributes are more or less modifiers, or descriptors for XHTML tags. For instance, 'color', 'face' and 'size' are all attributes of the 'font' tag. And just as with the XHTML tags, the attributes for the tags must also be in lower case only.

Correct Quotation:

Another change in the syntax you have been used to is that all attributes in XHTML must be quoted. In HTML you could have done this:

    <table width=100%>

.... but not in XHTML. The correct XHTML format for this code must be:

    <table width="100%">
Attribute Shortening:

Many web designers have learned that they can shorten some of the attributes in order to save time spent on coding. This method has become almost a standard. In XHTML However, this causes incompatibilities between browsers and other devices.

An old, bad example:
    <input type="checkbox" value="yes" name="go" checked>

In the above example, a shortcut has been used with 'checked'. The correct way when using XHTML has to be the long format, like this:

    <input type="checkbox" value="yes" name="go" checked="checked">
The ID Attribute

Probably the biggest change from HTML to XHTML is the one tag attribute change. All other differences have been just making tags more compatible. This is the only full change.

In HTML, the <img> tag has an attribute caqlled 'name'. This is usually used to refer to the image in javascript for doing actions like image rollovers. This attribute has now been changed to the 'id' attribute. So, the HTML code:

    <img src="house.gif" name="my-digs">

would need to be written in XHTML as:

    <img src="house.gif" id="my-digs" />

Of course, this would not be backward compatible with older browsers, so if you still want your site to work fully in all old browsers (as XHTML is intended to do), you will need to include both id and name attributes (this would also be correct XHTML):

    <img src="house.gif" id="my-digs" name="my-digs" />

That covers most of the differences between HTML and XHTML. As promised earlier, there aren't a whole lot of them. It's really not much of a job to make your site XHTML compliant; you'll feel better and be more up to date, so give it a go.

Here's a handy way to do the job: go to your website, to whichever page you want to update, and copy the url. Next, visit the helpful tool here at W3.org, and enter your page's url into their address box. Click the 'Check' button, and you will get a wealth of information about the page, and a detailed listing all the changes you need to make, with several different options that they have made available.

Thanks for visiting us, and come on back sometime soon!




   HOSTING:
Budget Plan Hosting
Dedicated Personal Hosting
Dedicated Professional Hosting
Dedicated Business Hosting












Updated on Tuesday, 05~4~2010

Copyright © 1998 - 2010
Bill Payne & Sitebilder© Network