Forum Moderators: open

Message Too Old, No Replies

Doc Type - what's it all about?

errors from the W3C validator

         

collymellon

3:23 pm on May 31, 2005 (gmt 0)

10+ Year Member



Another one..

My current doc type is set to:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

This works fine when previewing the page in I.E/FF. However 'the validator' throws numerous errors like this one:

Line 6, column 55: document type does not allow element "LINK" here
<link href="main.css" rel="stylesheet" type="text/css" />

I don't much about doc types (as you've probably guessed) and I just want my simple page (made up of 1 table) to work in most major browsers.

Could anyone give me a starting point on 'doctypes' so I can build this page with a solid foundation?.

Once again thanks

Looking at a few sites there is no doc type specified - is this the best option for an all round compliant site?

Farix

4:59 pm on May 31, 2005 (gmt 0)

10+ Year Member



It's because you are using XHTML when you have declared this document as HTML 4.01 Transitional. I suggest removing the /> from any tags you have to pass validation. While the /> is required for XHTML, it will not pass the mustard on HTML validation.

On other related note. It is suggested that you always use a full doctype instead of the partial one you have give. In this cause it would be:

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

tedster

5:05 pm on May 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



use a full doctype

And if you do, be ready for browsers to render things differently. Learn more in this thread:

Standards Mode and Quirks Mode [webmasterworld.com]

collymellon

5:23 pm on May 31, 2005 (gmt 0)

10+ Year Member



thanks for this. I will have a good read later on the post pointed to. This site has to be bobby approved (fully accessible) - I get the impression I have to use a strict doc type for this..

Robin_reala

8:09 pm on May 31, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



You can make an accessible page using a ransitional doctype but you're almost certainly not going to be using anything more than what's in strict so you might as well stick with it.

About accessibility - bobby isn't enough. You need to thoroughtly read the WCAG guidelines and do some reading around to make sure you're not making any obvious mistakes. A lot of accessibilty can't be machie tested in a meaningful way today. I'd suggest accessify.com as a good starting point.

collymellon

9:26 am on Jun 1, 2005 (gmt 0)

10+ Year Member



great info, much needed thanks..

collymellon

10:04 am on Jun 2, 2005 (gmt 0)

10+ Year Member



Reading over the excellent information provided I still can't find a doctype that suits my site requirements - a little pointer would be much appreciated.

Its an ASP site that has to be accessible approved, all the pages are quite flat - 1 table, couple of images and a RAD panel bar for the menu (this is java menu but RAD claim that is will pass accessibilty checks)

XHTML vs HTML - whats the major differences?

With this being an asp site when I use XHTML strict doc type theres no chance of validation, change it to XHTML basic and it throws more errors. I'm stuck at a standstill at the minute..running out of hope

Robin_reala

12:29 pm on Jun 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



ASP is a server side language so it (theoretically, hah!) will generate whatever you want. The difference between XHTML and HTML is that XHTML is a reformulation of HTML as an application of XML. If you don't know what that means or why you'd want to do that then go for HTML.

The applet element is deprecated as of HTML4, so you'll want to be using a transitional doctype. Unless ASP's generating an object element for it, but I doubt that. Having said that, I'd still be extremely surprised if the applet was considered accessible. Does it obey tabindexes? Is it keyboard navigable? Can screenreaders access it? If not then I'd leave it well alone. If you do stick with it make sure to replicate the menu structure as a fallback inside the applet element and provide a 'skip to main content' link. Also, bear in mind that's there's a difference between "accessible" and "passing accessibility checks".

encyclo

1:35 pm on Jun 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Have you tried an XHTML 1.0 Transitional (not Basic) doctype?:

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

Once you've got that in place, what kind of errors/warnings are you getting? The above doctype is the most forgiving and flexible of the XHTML doctypes.

g1smd

4:31 pm on Jun 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Remove the / from the link tag, and meta tags in the head.

That is the problem. You cannot use them with HTML 4.01.