PDA

View Full Version : Creating Standards-Compliant HTML and XHTML



Narasinha
11-28-2003, 01:53 AM
I recently read an article entitled Retooling Slashdot with Web Standards at http://www.alistapart.com/articles/slashdot/, on the A List Apart web site. In it, the author describes the process used to convert the existing content of the front page of the slashdot.org web site from its current level of HTML 3.2 to XHTML 1.0 Trasitional. They also describe the benefits of such an update.

In addition to the pages rendering correctly in standards-compliant browsers, the pages fail in a more "graceful" manner in older browsers, with the content still available. This content is also available to users of PDAs and web-enabled cellular telephones. The HTML file itself is about 2k smaller in size, and when the CSS file is already cached by the browser, about 9k is saved for each transfer. The file-size reduction may seem tiny, but when considering the traffic of 50 million page views per month (as of June 2000) the savings are substantial: 3.15 GB per day without caching the CSS files, and 14 GB per day when the CSS file is already cached. Their projected savings for slashdot.org's bandwidth at a conservative 10 GB per day is 3650 GB per year. Financially, this could be significant.

So, as I often do here, I am extolling the virtues of creating your web pages according to current HTML or XHTML standards. Many people, particularly those just learning HTML or learning to use one of various HTML creation/editing tools, do not know a lot about how to standardize their pages. If you feel the need or desire to meet current standards, I have outlined what I believe to be some of the best steps you can take.

Using Valid Standards-Compliant HTML or XHTML
This is not as hard as it sounds. First, you need to decide which HTML or XHTML version you are using to build your site. Several different versions are possible. The most prevalent are HTML 3.2, HTML 4.01 (Either Transitional, Strict, or Frameset), XHTML 1.0 (Either Transitional, Strict, or Frameset), and XHTML 1.1. Which version applies to your pages? That depends on what tags you are using and how you are using them. It also depends on whether or not you are using Cascading Style Sheets to define the layout and look of your pages. Index Dot HTML at http://www.blooberry.com/indexdot/html/index.html is an excellent resource of information about HTML tags. You can easily find out if a specific tag is no longer allowed (known as deprecated) in a certain HTML version, as well as which browers support it or have problems with it.

How do you indicate what version of HTML you are using? You place a <!DOCTYPE...> tag as the first line of your HTML files. This tag states the version of HTML or XHTML in which your page is written. This is important because modern browsers read this tag and decide how to display your page based on the version of the HTML. Depending on which DOCTYPE is used, the browser will either attempt to render the page according to the W3C standards it supports or use the legacy rendering behavior that many older pages rely on. It can help your pages maintain a more consistent look across different browsers and platforms.

What does a DOCTYPE tag look like? Here are some of the tags you would use to describe the level of HTML you are using:

For HTML 3.2:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//EN">

For HTML 4.01 Transitional:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

For HTML 4.01 Strict:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">

For HTML 4.01 Frameset (Pages that contain frames structure, not the HTML pages that are inside those frames):
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Frameset//EN" "http://www.w3.org/TR/html4/frameset.dtd">

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

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

For XHTML 1.0 Frameset (Pages that contain frames structure, not the HTML pages that are inside those frames):
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Frameset//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-frameset.dtd">

For XHTML 1.1:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">

How do I know if my pages are valid?

It is not easy to know from simply looking at your code whether or not your HTML conforms to the standards. Validator programs can look at your code and spot specific problems. Errors in your code can "cascade" making it seem that there are several problems when there is actually just a single error. I find it easiest to go through the validator's results one error at a time, fixing each problem and re-validating. The World Wide Web Consortium which develops the HTML standards has an online validator that you can use to check pages that are online or on your local hard drive. You can find it at http://validator.w3.org/. This can be difficult and extremely time-consuming for large sites containing dozens or even hundreds of pages. In such cases it is wise to use a validator program that runs on your own computer. A Real Validator (available from http://www.arealvalidator.com/) is one such program available for the Windows platform. With it you specify which pages are part of a project and allow the program to check each one for standards compliance. It will describe each error individually, telling you at which line the error occurred. For some errors, links are provided to HTML references for a particular tag or type of tag so that you can learn why the code is not compliant. Repairing an error more than a few times helps to remind you of the correct method to use when writing your code. Validators can be invaluable learning tools.

Learning HTML will always be an ongoing process. The standards change and evolve, as do the browsers. A good understanding of the tags, their structure and syntax, and their proper implementation will help you to construct web pages that require less maintenance, consume less bandwidth, are more accessible, and can be more easily updated to the next level of standards when they arrive.

paulhiles
11-28-2003, 06:06 AM
Excellent post Narasinha, I'm sure Brittany will be in touch with you soon requesting articles for future iEntry newsletters ! ;-)

Thought I'd add an additional link which some members may find of interest (especially those working in XHTML) The XML Standards Project site offers a number of basic templates for download here (http://www.xmlstandards.org/resources/templates/).

Note: the word 'template' is used a bit loosely here.. but at least the newbie can see how the doctype would fit in with the rest of their page and the initial 'html' tag. The remainder of the site is still awaiting copy, but looks like it could become a useful resource when complete.

Paul

Narasinha
11-28-2003, 06:24 AM
Thought I'd add an additional link which some members may find of interest (especially those working in XHTML) The XML Standards Project site offers a number of basic templates for download here (http://www.xmlstandards.org/resources/templates/).

Thanks Paul. I like the Templates page there. It brings to mind another "bug" as well. It seems that Internet Explorer 6 and Opera 7.0x both have the same problem with the <?xml...> tag as the first line of a document. If there is anything before the <!DOCTYPE...> line, both revert to "quirks" display mode rather than the expected "standards" mode. This may have been fixed in subsequent releases of Opera or patches for IE, but I'm not sure.

matauri
11-28-2003, 06:26 AM
Narasinha, why couldn't you have written that about 3 months ago? :-)

I understood in one read of your post which took me several reads of W3C's site to understand. Maybe you should go write for them! ;-)

I still have trouble with distinguishing between Strict & Transitional HTML, so if you care to write another posting about them, I'd be grateful :-)



Cindy

carbonize
11-28-2003, 08:15 AM
Problem with XHTML is it's getting to the point where you're less making a website than writing software. The way you have to include components etc is going to make life damn complicated.

Narasinha
11-28-2003, 10:54 AM
Narasinha, why couldn't you have written that about 3 months ago? :-)

I understood in one read of your post which took me several reads of W3C's site to understand. Maybe you should go write for them! ;-)

I still have trouble with distinguishing between Strict & Transitional HTML, so if you care to write another posting about them, I'd be grateful :-)

Cindy

Always glad to oblige. :)

It is difficult to gain a good working understanding of HTML by reading most portions of the W3C's web site. I guess it's like trying to understand how to better operate your computer by reading the technical specifications of its CPU.

Transitional document types allow you to use certain tags ( <font size="small"> ) and attributes ( <p name="first">, <a href="link.html" target="_blank" ) which are scheduled to be removed from the document standard. This is in order to allow authors and their pages to move from the older to the newer standard gradually. The transitional document type includes several items which are geared toward the presentation of the content rather than a semantic description. In the strict document types all presentation is controlled by CSS.

XHTML 1.0 is basically an XML version of HTML 4.01. The strict and transitional versions relate in the same way. In XHTML all tags and attributes must be lower case. One other major difference is that all tags must be closed. If you have a

it must be closed with a </p>. In cases where tags would normally stand alone such as an image, line break, or horizontal rule, the tag is closed in this way: image.gif,
, <hr />.

XHTML 1.1 is a new version of XHTML 1.0 Strict using XHTML Modules. This means that some things available in other XHTML document types (like frames) are not available in XHTML 1.1. However, XHTML 1.1 is based on the modular aspect of XML, allowing authors to create their own custom DTDs. This would let you use tags and attributes that have been removed, or create new options that you would like to see in your code.

The following tags, for example, are "deprecated" in HTML 4.01, meaning that they are allowed in transitional documents but not strict documents:<applet>, <basefont>, <center>, <dir>, <font>, <menu>, <s>, <strike>, and <u>.

There are other changes, such as those concerning attributes which are allowed in transitional but not strict document types. A brief article titled XHTML Transitional, Strict - What?s the Difference? (http://www.brainstormsandraves.com/archives/2003/10/21/xhtml/) contains a few links to resources describing the specific items which are changed or disallowed in strict XHTML. There are also two references at w3schools.com that list the tags and their level of support: HTML 4.01 Reference (http://www.w3schools.com/html/html_reference.asp), and XHTML Reference (http://www.w3schools.com/xhtml/xhtml_reference.asp).

matauri
11-28-2003, 11:54 AM
Thanks ever so much for that Narasinha ! Thats what I like to read, easy & concise.

Now you talk about depreciated, does this mean they are eventually taking them out of standards? If so, what would replace things like target=_blank ?


Cindy

paulhiles
11-28-2003, 12:07 PM
Now you talk about deprecated, does this mean they are eventually taking them out of standards? If so, what would replace things like target=_blank ?
Hi Cindy,
I think I recall Narasinha had a similar discussion with carbonize here (http://www.webproworld.com/viewtopic.php?p=43969&highlight=strict+target#43969).

Paul

Narasinha
11-28-2003, 12:10 PM
Thanks ever so much for that Narasinha ! Thats what I like to read, easy & concise.

And I thought I was getting long-winded!


Now you talk about depreciated, does this mean they are eventually taking them out of standards? If so, what would replace things like target=_blank ?

Yes, those tags or attributes are removed from the strict DTDs. Carbonize and I had a discussion about this. There is no replacement for the target attribute in XHTML strict. Technically, it was meant to be part of the functionality of frames. Since frames are gone, so is target. Strict HTML and XHTML are meant to be semantic markup languages, thus they should only describe the content. All layout and display properties are done through CSS, and any actions that are performed should be done through the DOM (Document Object Model), generally with JavaScript, Java, Flash, etc. It is possible to use the target attribute in XHTML 1.1, but only if you write your own DTD module and instead of the URL for the W3C's DTD in your DOCTYPE tag you put the URL of your own DTD. I don't really know how to go about writing a DTD module for XML, but that's how I understand it can be done. It does seem more complicated than it should be, but they're sticking to the original intent of HTML only describing content.

carbonize
11-28-2003, 02:27 PM
I see Matauri is letting the side down. She may always define a background colour but she doesn't always quote her attributes. hehehehe.

I'm currently using XHTML 1.0 transitional so that I can use target="_blank" to open offsite links in a new window but I'm thinking maybe I'll switch to XHTML 1.0 strict or XHTML 1.1 strict and use javascript instead despite my previous comments about javascript. What are your feelings on this? DO I stick with target="_blank" or use javascript instead?

Narasinha
11-28-2003, 05:53 PM
I see Matauri is letting the side down. She may always define a background colour but she doesn't always quote her attributes. hehehehe.

Oh yeah! That's another thing that's required. Forgot about that one.


I'm currently using XHTML 1.0 transitional so that I can use target="_blank" to open offsite links in a new window but I'm thinking maybe I'll switch to XHTML 1.0 strict or XHTML 1.1 strict and use javascript instead despite my previous comments about javascript. What are your feelings on this? DO I stick with target="_blank" or use javascript instead?

Well, if the target attribute is the only reason you would use transitional rather than strict, I would suggest going with JavaScript, and use a small graphic or text identifier for links that go off-site. Here's my reasoning on this one:

Most people browsing the web use Internet Explorer because it came with their computer. Most people don't know anything about the advanced options of their browser, such as turning off JavaScript. The only people likely to forget they were at your site before (and now they don't know quite where they are) are these people. Experienced browsers will recognize the off-site links and often will open them in a new window anyway. Also, if JavaScript is turned off, the link itself will still function normally.

I noticed a couple places using custom DTDs so they can use the target attribute. If I find out more details about that option, I'll pass them along so we can all put it to use if needed.

matauri
11-29-2003, 05:26 AM
I see Matauri is letting the side down. She may always define a background colour but she doesn't always quote her attributes. hehehehe.
I quote my 'attributes' when the need arises ;-)


And I thought I was getting long-winded!
Long winded is reading thru 100's of W3C pages! I could have just asked you! Usually I keep getting told to RTFM! :-)


I think I recall Narasinha had a similar discussion with carbonize here.
Thanks for that Paul. I am still trying to figure what the advantages are in designing in XHTML, and that thread didn't affirm it any further :-)


Also, if JavaScript is turned off, the link itself will still function normally.
By discussions on the accessibility threads I gathered there was meant to be some functionality issue regarding the use of javascript for this. (tho I could never see them)

Thanks guys !


Cindy

paulhiles
11-29-2003, 07:34 AM
Thanks for that Paul. I am still trying to figure what the advantages are in designing in XHTML
I think that Narasinha has already mentioned most of the important benefits in switching to XHTML. One thing to realise is that the W3C is no longer supporting HTML as a standard (this was announced way back in 2000). XHTML is now the 'de facto' markup language for web content and is fully supported by the W3C.

Compatibility - With a single standard your pages should be displayed consistently in any standards-compliant browser. Compared to the current sitution, where we have multiple variations/flavours of HTML interpreted differently by idiosyncratic browsers.

Delivery - XHTML is also a standard for content delivery to web-enabled mobile phones, PDA's and other wireless devices. Thus extending the potential audience for your website's products and services.

Extensibility - XHTML works with XSLT (used in transforming data) and other XML technologies such as MathML to present mathematic and scientific data, thus dramatically increasing the possibilities of the humble web page.

Interactivity - XHTML supports recent advances in JavaScript that older versions of HTML do not. Scripts and applets that use the Document Object Model (DOM) can be embedded in XHTML documents.

Structure - The use of CSS for all formatting, separates the document structure from the display elements, this gives two benefits... reducing the file size and increasing options for the document's potential output across platforms.

Future Proof - by switching to XHTML you will be using valid, standards-compliant markup which will ensure that data will be re-usable in years to come, as well as satisfying the requirements of current browsers.

So you see there are advantages to be gained in switching to XHTML. I won't say that it'll be an altogether painless process, but it does ultimately make a lot of sense. Standards will help improve the user's experience, and faster-loading, more consistent viewing is in everyone's interests!

Paul

matauri
11-29-2003, 07:42 AM
Thank you for all that information Paul...most appreciated :-)

So basically it is better to scrap use of HTML now in favour of XHTML? Are there any downfalls to coding only in XHTML?


Cindy

mikmik
11-29-2003, 07:49 AM
I understand that 'xml' and 'html' are designed to display data, ie 'CONTENT' and that 'css' is designed to add 'style' by assigning 'attributes' to the 'content'.

matauri wrote:
Thanks for that Paul. I am still trying to figure what the advantages are in designing in XHTML, and that thread didn't affirm it any further :-)

The answer(which I only just got clear on now)is that:
a) using XML purely for structuring content and CSS purely for styling content is how future standards are going to be.
b) using HTML for both (tables and 'font' etc in the document body) is passing the way of the dinasour!

C) THEREFORE XHTML is a 'BRIDGE' between the past (deprecated) and the future,

IT IS BOTH FORWARDS AND BACKWARDS COMPATIBLE! (Works in most 4.0 and up to this and maybe next generation browsers, 6,7,8? and that's all she wrote!

That way the web can move towards and adopt the desperately needed universal standards, to accomodate computers and Cell Phones, PDA's, etc.

Here are two fantastic scources:
http://www.sizefactory.com/xhtml/index.html and
http://www.w3schools.com/XHTML/xhtml_why.asp which has this:
XML is a markup language where everything has to be marked up correctly, which results in "well-formed" documents.

XML was designed to describe data and HTML was designed to display data.

Today's market consists of different browser technologies, some browsers run internet on computers, and some browsers run internet on mobile phones and hand helds. The last-mentioned do not have the resources or power to interpret a "bad" markup language.

Therefore - by combining HTML and XML, and their strengths, we got a markup language that is useful now and in the future - XHTML.

XHTML pages can be read by all XML enabled devices AND while waiting for the rest of the world to upgrade to XML supported browsers, XHTML gives you the opportunity to write "well-formed" documents now, that work in all browsers and that are backward browser compatible !!!

carju1
11-29-2003, 08:35 AM
Thanks for that Paul. I am still trying to figure what the advantages are in designing in XHTML, and that thread didn't affirm it any further :-)

Advantage No1. Paul, Carbonize and Narashina won't nag at you any more ;)
Disadvantage No1. Paul, Carbonize and Narashina will (as excellent members) keep pointing out errors in your XHTML for the next 2 years.

Advantage No2. You get three brilliant teachers for free.
Disadvantage No2. You'll then start having to nag at use pathetic people still using HTML

Advantage No3. You'll be ahead of the game when everyone switches in a couple of years.
Diasadvantage No3. Most Australians think the only good thing to add an X to is three more X's and stick Castlemain in front of it.

Julian

carbonize
11-29-2003, 08:52 AM
Nope. I'm not going to jump on anyone for using HTML. If it works for you then use it is my philosophy (taken from my Jeet Kune Do experience).

I can't see XHTML catching on that well given the lengths you're going to have to goto for doing things like target="".

How would I do a link that uses javascript to open a new window but at the same time degrades so that it's a normal link when they have javascript turned off?


blah (newpage.html)

I know the window.open part is right but it's getting the current window not to change unless they have javascript turned off thats eluding me.

mikmik
11-29-2003, 09:01 AM
Happens all the time!
I start a post, and by the time I hit 'submit', someone, in this case "paulhiles", has come-seen-had coffee and thought-typed reply-submitted...
So I meant no disrespect!
paulhiles enlightened this 'less-than-lightening-quick' student:
Interactivity - XHTML supports recent advances in JavaScript that older versions of HTML do not. Scripts and applets that use the Document Object Model (DOM) can be embedded in XHTML documents.
Thanks, something I wasn't aware of, and there will always be plenty!

To carbonize, could you use javascript or another (VBS, perl, PHP) to detect if .js is disnabled so that a 'hidden' div containing the link would appear? I was looking at narasihna's link btu it didn't address this. How about a class - .open{target:new;}, or something?

mikmik
11-29-2003, 09:19 AM
Nevermind, narasihna already answered my 'target' question:
It is possible to use the target attribute in XHTML 1.1, but only if you write your own DTD module and instead of the URL for the W3C's DTD in your DOCTYPE tag you put the URL of your own DTD. I don't really know how to go about writing a DTD module for XML, but that's how I understand it can be done. It does seem more complicated than it should be, but they're sticking to the original intent of HTML only describing content.

matauri
11-29-2003, 11:56 AM
I been doing some reading on this tonite. While I dont see the switch as all that hard (maybe), it seems as though XHTML is going to be a bit of a pain to trouble shoot.

Thoughts?



Cindy

mikmik
11-29-2003, 12:12 PM
Matauri wrote:
I been doing some reading on this tonite. While I dont see the switch as all that hard (maybe), it seems as though XHTML is going to be a bit of a pain to trouble shoot.

Thoughts?
Good luck! lol
Do you mean trans or strict? Do you use an editor?
Do you think you have enough problems with Moz and IE?
I' better let you guy's handle it, but it might not be that bad, mat. I tried going strict about two weeks ago, I think I ended up with about half being good for transitional.
Unfortionly, I got session with client soon, probably be all day, then sleep, so 'do good' Cindy (O;

Narasinha
12-02-2003, 02:19 AM
Regarding the questions about opening a link in a new window, while still meeting strict standards, I found a good JavaScript solution. If JavaScript is enabled, the links open in a new window, just like they would with the 'target="_blank"' attribute. With JavaScript disabled, the links acts like any other link, opening in the same window. I would say that qualifies as "degrading nicely". It does meet standards as the new window is handled by the DOM, not the HTML (or XHTML).

To Strict, or not to Strict?

Are you considering rebuilding a site? Building a new site? Lots of people seem unsure of what standard they should be using for new sites and pages. Most people probably aren't very sure of what "flavor" of HTML their existing site consists in the first place.

If you have a site that doesn't have a !DOCTYPE specified, you don't use CSS for all of your site's display charateristics, and you really don't know what level of conformance it might have, etc., I would suggest standardizing your page to HTML 4.01 Transitional. This is probably best for people who aren't as comfortable writing all of their HTML by hand. WYSIWYG editor output is usually closest to this standard.

Does your site already meet 4.01 Transitional standards? If you want to keep some elements of your site, like <font> tags, I would suggest moving to XHTML 1.0 Transitional. HTML standards stop at 4.01. There will be no expansion of the HTML standard in the future. If you have a site that meets 4.01 standards, it should be quite simple to move it to XHTML 1.0. You will have to be sure that all tags and attributes are lower case, all tags are closed, and all attributes are quoted.

If you have a site that uses CSS for all of its display characteristics, separating all of the content from the style, I would suggest using XHTML 1.1. Yes, it would qualify for HTML 4.01 Strict or XHTML 1.0 Strict, but it would probably be very near meeting the XHTML 1.1 standard. XHTML 1.1 is a strict standard. No deprecated tags are allowed. If you can easily meet the current highest standard, then that's the way to go. XHTML 1.1 is the beginning of HTML's new life as a part of XML. Meeting the current top standard means it will be easier to upgrade in the future.


I been doing some reading on this tonite. While I dont see the switch as all that hard (maybe), it seems as though XHTML is going to be a bit of a pain to trouble shoot.

I still do it the way I always did with meeting HTML 4.01 Transitional or Strict. I get the page looking and behaving the way I want in three different browsers (IE 6, Opera 7, Firebird 0.7), then I run it through a validator, fixing each error down the list and revalidating.

Lots of people use the W3C or other online validators. I know of the CSE Validator (I used it years ago), and A Real Validator that I mentioned above. Here are some resources for validating your pages:

Online Validation Services
W3C Markup Validation Service (http://validator.w3.org/)
WDG HTML Validator (http://www.htmlhelp.org/tools/validator/)

Offline Validation Tools
Offline HTMLHelp.com Validator (http://www.htmlhelp.org/tools/validator/offline/) Primarily for Unix/Linux users
A Real Validator (http://arealvalidator.com/) Shareware Validator for Windows
CSE HTML Validator (http://www.htmlvalidator.com/) Windows. HTML, XHTML, and CSS validator. Also checks accessibility, links, and spelling. Commercial pro version and free lite version.
HTML Tidy (http://www.w3.org/People/Raggett/tidy/) Unix, Windows, MacOS, and others. Validator fixes errors in HTML and XHTML. Converts HTML to XHTML. Free Software.

StarE
12-02-2003, 02:39 AM
Keep spreading the good word.

The sooner we can loose all those font tags and use tables for data instead of page layout, we will all be in a better place.

-StarE

carbonize
12-02-2003, 03:27 AM
When I did an accessibility report on my new project I was informed that I needed to use the <label id=""> tag for labelling my inputs etc instead of a header, but when I decided to test my site as XHTML strict I got informed that <label id=""> is now deprecated and I should use header, talk about confusing.

Narasinha
12-02-2003, 05:02 AM
When I did an accessibility report on my new project I was informed that I needed to use the <label id=""> tag for labelling my inputs etc instead of a header, but when I decided to test my site as XHTML strict I got informed that <label id=""> is now deprecated and I should use header, talk about confusing.

Okay, I think it's supposed to go like this:
The id="username" attribute is a part of a specific form <input> tag. The for="username" attribute is part of the <lable> tag that corresponds to a particular input. You can leave out the for="username" if the <label></label> surrounds the intended <input>. You should also place the accesskey="U" attribute in the label tag if you are using accesskeys. Here is one example of part of a form:


<div class="row">
<label for="contactName">Name:</label>
<input type="text" id="contactName" value="" />
</div>
The displayed text Name: is the label for the input field displayed next to it.

I knw there are some problems with the accessibility/validation checks when using radio buttons. Sometimes they complain that you cannot have the same id set for more than one item. I don't know how this is supposed to work. They just made some changes yesterday to the XHTML portion of the W3C validator to fix some bugs. Maybe this will take care of some of that.

carbonize
12-02-2003, 11:27 AM
No the online W3C validator said label was not a valid tag and I should use a header instead.

minstrel
12-02-2003, 12:22 PM
I should use a header instead.
You sure you weren't accidentally on that soccer or "football" as-you-call-it website again?

Narasinha
12-02-2003, 11:37 PM
No the online W3C validator said label was not a valid tag and I should use a header instead.

I find this very odd. I made up a very simple test page at http://www.soltec.net/~dmg/formtest/index.html to see what I could find out about the label tag (which I will be using in a project to make a phpBB2 forum template conform to XHTML and Accessibility standards).

The code for the form is very simple:

<form action="test.html" method="post">
<div class="row">
<label for="contactName">Name:</label>
<input type="text" id="contactName" value="Enter Name" />
</div>
<div class="row">
<input type="submit" value="Submit" />
</div>
</form>
I have it set in the DOCTYPE as XHTML 1.1 (Were you using XHTML 1.0 Strict?). Both A Real Validator and W3C's online validator said "This Page Is Valid XHTML 1.1". I replaced the DOCTYPE with XHTML 1.0 Strict and got valid results as well.

I ran it through Bobby (http://bobby.watchfire.com/) to check accessibility (WAI Guidelines), and it checks out as AAA approved. There is a user-check that always comes up for forms: If there are logical groupings of form controls, use FIELDSET with LEGEND on each group. There is no way for the automated scripts to know the context of the form fields and their purposes, so this is always pointed out for forms that go through Bobby. This doesn't seem to apply to your situation though.

I don't think I understand about using a "header". Label is definitely an XHTML 1.0 Strict and XHTML 1.1 valid tag, not deprecated. Do you currently have a page online that generated this error?

carbonize
12-03-2003, 08:35 AM
Looks like the problem may be more down to my layout than the tag not being valid. It's weird that it validates as transitional but not strict. But then again transitional is weird.

carbonize
12-03-2003, 08:52 AM
Fixed it, it wanted me to put in the fieldset tags :|