Forum Moderators: open

Message Too Old, No Replies

validation help needed

a few errors which i don't understand

         

HelenDev

1:46 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's a dull rainy afternoon so I have finally decided to have a go at fixing some of my pages.

First off, I am trying to validate to HTML 4.01 Transitional.

it seems to have a problem with my stylesheet link

Line 16, column 57: document type does not allow element "LINK" here

<link href="/styles.css" rel="stylesheet" type="text/css">
... what on earth is wrong with this?! Do I need to have elements in <head> in a certain order?

Any help would be appreciated.

Cheers, Helen.

IONWeb

1:59 pm on Apr 16, 2004 (gmt 0)

10+ Year Member



Afternoon Helen,

Try this:

<link rel="stylesheet" type="text/css" href="/yourpage.com">

I believe this is correct for 4.01

HelenDev

2:05 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks. However, I have just removed an end tag from one of my meta tags (apparently meta end tags are not allowed), and it is now not saying the stylesheet is wrong any more, plus a whole bunch of other errors like 'element <body> is not allowed here'...

That's why I find this validation thing such a mystery, it seems to be suggesting errors where there aren't and not telling me the real problems!

It'll teach me not to pinch other people's badly written code though!

IONWeb

2:17 pm on Apr 16, 2004 (gmt 0)

10+ Year Member



Are you validating in an editor or at W3C?
A misplaced tag or closing can cause other errors that are not really errors - which is what you just saw.

HelenDev

2:30 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Are you validating in an editor or at W3C

I am at the W3C site. Are there any better ways?

IONWeb

2:47 pm on Apr 16, 2004 (gmt 0)

10+ Year Member



No.. not at all... the W3C site is the place to be. It has explanations of the errors (sometimes you have to dig to find out what they actually mean)
Also, your editor (if you use one) can be set up to validate pages, but is always a good idea to run a "second opinion" at W3C. If you want, sticky me the url and I'll take a peek.

bruhaha

2:53 pm on Apr 16, 2004 (gmt 0)

10+ Year Member



Are there any better ways?

I find it easier to use a separate validator on my desktop. In my case, that's CSE HTML Validator Pro from [htmlvalidator.com ].

It's much better than the basic validator included in editors, and easier to rerun as I make code corrections. (Also, in my experience, it gives more helpful error messages and suggestions than W3G, though that may vary according to the error.)

HelenDev

3:07 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers for the offer, IONWeb, I might take you up on it if this drives me completely mad. In the meantime I'm gonna try and figure it out (hopefully with a little help from everyone here :) of course)

I have a couple of specific questions...

1) should I not have border="0" inside my image tags? If not I take it I should put it in the stylesheet?

2)I have a table with a name attribute. Is this now replaced with id and if so can I safely remove it? I notice that if I ever use Dreamweaver to code it puts both name and id. I think the reason the table is named at all is that it is used in a bit of javascript.

Cheers,

Helen.

IONWeb

5:35 pm on Apr 16, 2004 (gmt 0)

10+ Year Member



should I not have border="0" inside my image tags?

I do not see why having the border=0 will hurt anything - personally I do not use it unless the image is a link. I code in XHTML and the border attrib still validates.

I have a table with a name attribute. Is this now replaced with id and if so can I safely remove it?

I guess that depends if the id is tied into the script you were referring to or perhaps it is a stylesheet selector - just guessing without seeing the code ;)
Here is some reading on it that may help [w3.org...]
Is the page not validating because of it?

encyclo

5:43 pm on Apr 16, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



I have just removed an end tag from one of my meta tags (apparently meta end tags are not allowed), and it is now not saying the stylesheet is wrong any more, plus a whole bunch of other errors like 'element <body> is not allowed here'...

Your problem lies before the link, body etc. tags. Sometimes the validator can't identify exactly where the error starts, so you have to work backwards. You say that you removed a meta tag? You may be missing a closing quote mark or angle bracket. Solve this one problem, and the others will be fixed, as the missing element is cascading down and producing many if not all the other validation errors. If you can't spot it (it's usually in the line immediately before the first error), then post your document from the DOCTYPE down to the opening <body> tag and we'll see if we can spot it.

As for

border="0"
om image tags, it is fine in HTML 4.01 Transitional, although you can omit it if you are defining the border value with CSS. For the name attribute, I wouldn't remove it unles you're very sure it is not required by a script. It will also validate fine for HTML 4.01 Transitional.

HelenDev

3:43 pm on Apr 20, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Thanks for all the info guys.

I think that the table in question is named for a reason, I will have to have a look at the javascript and css in the page and work it out.

I think I am getting the hang of this whole validation thing. I assumed at first that the reported errors would be the exact thing they were pointing to. Now I know that this is not necessarily the case it might help.

Unfortunately it has stopped raining and I have to go and get on with some real work. No doubt I'll be back at this validation thing again sooner or later though.

Helen.

** dreams that one day she can legitimately put one of those cute little this-page-validates imgs on her pages **