Page 1 of 1

Almost done :)

Posted: Sat Aug 12, 2006 6:07 pm
by alex.barylski
I have received the following errors when validating my site against XHTML strict...

One, is that <A> doesn't support target="_blank"??? WTF how am I supposed to open links in new windows???

Two, is I have used a <label> inside a FORM
Line 50 column 25: document type does not allow element "label" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<label for="catlist">Categories</label>
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
I have no idea how the heck to fix this error...do I have to surround my labels with a P tag or something? Isnt' that overkill???

One more thing :P

I am using tables, but very limitedly...if there are no valign attributes in TD's anymore, how the heck am I supposed to vertically align any content??? There isn't a equivelant CSS attribute is there???

Re: Almost done :)

Posted: Sat Aug 12, 2006 6:13 pm
by feyd
Hockey wrote:I have received the following errors when validating my site against XHTML strict...
I'd validate against HTML 4.01 Strict.. unless you want to server content to only the few browsers that support the content-type needed for XHTML.
Hockey wrote:One, is that <A> doesn't support target="_blank"??? WTF how am I supposed to open links in new windows???
Javascript trickery. http://www.sitepoint.com/article/standa ... iant-world
Hockey wrote:
Line 50 column 25: document type does not allow element "label" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag.
<label for="catlist">Categories</label>
The mentioned element is not allowed to appear in the context in which you've placed it; the other mentioned elements are the only ones that are both allowed there and can contain the element mentioned. This might mean that you need a containing element, or possibly that you've forgotten to close a previous element.

One possible cause for this message is that you have attempted to put a block-level element (such as "<p>" or "<table>") inside an inline element (such as "<a>", "<span>", or "<font>").
I have no idea how the heck to fix this error...do I have to surround my labels with a P tag or something? Isnt' that overkill???
It's a bit of an overkill. You could just do away with the labels. :o

Re: Almost done :)

Posted: Sat Aug 12, 2006 7:08 pm
by alex.barylski
I'd validate against HTML 4.01 Strict.. unless you want to server content to only the few browsers that support the content-type needed for XHTML
Cool, ok, whats the validator thing?

Code: Select all

<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
Is what I have thus far...is this correct?

Code: Select all

<?php echo "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.1 Strict//EN" "http://www.w3.org/TR/html41/DTD/html41-strict.dtd">
It's a bit of an overkill. You could just do away with the labels.
Do you still get screamed at for HTML 4.01 strict?

Aren't labels used by screan readers, etc to announciate the information?

Re: Almost done :)

Posted: Sat Aug 12, 2006 7:37 pm
by feyd
Hockey wrote:Cool, ok, whats the validator thing?
Validator thing?
Hockey wrote:

Code: Select all

<?php echo "<?xml version="1.0" encoding="UTF-8"?>\n"; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.1 Strict//EN" "http://www.w3.org/TR/html41/DTD/html41-strict.dtd">
Lose the <?xml ?> tag and this is the actual doctype

Code: Select all

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
Hockey wrote:Do you still get screamed at for HTML 4.01 strict?
Image
Hockey wrote:Aren't labels used by screan readers, etc to announciate the information?
Possibly? I can't say as I don't use a screen reader.

Posted: Sun Aug 13, 2006 12:44 am
by RobertGonzalez
Hockey, why not throw a little client side magic into your markup to achieve the new window linking effect? And as for the lables, remember, the <form> element is not a block level element like <p>, <div>, etc. So when you put text inside of <form> tags, you are not necessarily inside a block-level element. That is why the validator allows<p> tags inside of <form> tags, and why the <lable> tag requires a block level tag around it. It is not overkill, it is proper markup.

Posted: Sun Aug 13, 2006 9:00 am
by Benjamin
Frankly I really don't care if a page fails validation because I am using a target attribute in an a tag. KISS

Posted: Sun Aug 13, 2006 9:20 am
by Chris Corbyn
astions wrote:Frankly I really don't care if a page fails validation because I am using a target attribute in an a tag. KISS
It's to do with specifications. If you tell the browser it's XHTML 1.1 when actually it's HTML 4.0 how can you expect the browser to render it correctly? It's like sticking ASP code in PHP tags and expecting the server to pick up on the fact it's not really PHP and parse it as ASP.

Not everything is related to accessibility... there are other reasons for validating code. It *should* bother you if your code does not validate... you cannot complain if some obscure browser does not display your page correctly if you've knowingly defined the wrong doctype.

Posted: Sun Aug 13, 2006 9:34 am
by Benjamin
Well I've read arguments going both ways on that one. I don't want to take this off topic though. Let me see if I can dig up some of the things I read and I'll make a new post.

Re: Almost done :)

Posted: Sun Aug 13, 2006 11:48 am
by Oren
Hockey wrote:One, is that <A> doesn't support target="_blank"??? WTF how am I supposed to open links in new windows???
You are not supposed to :wink:
Everybody hates new windows.

Posted: Sun Aug 13, 2006 12:13 pm
by matthijs
Everybody hates new windows.
me too :x
Just tell your client opening windows is old-fashioned. I estimate that 3/4 of my clients have brought forward that links should open in new windows. So far, I have been able to convince all of them we shouldn't do it :)

Posted: Sun Aug 13, 2006 12:23 pm
by Oren
matthijs wrote:me too :x
Just tell your client opening windows is old-fashioned. I estimate that 3/4 of my clients have brought forward that links should open in new windows. So far, I have been able to convince all of them we shouldn't do it :)
Good job matthijs, that's cool 8)