views:

299

answers:

4
<td align="left" valign="top"> is it mean both are valid?
+1  A: 

Why error? One is align (horizontal alignment), one is valign (vertical alignment), both can present.

From http://www.w3.org/TR/xhtml-modularization/abstract_modules.html#s_tablemodule, the attributes of <td> contain align ("left" | "center" | "right" | "justify" | "char") and valign ("top" | "middle" | "bottom" | "baseline")

KennyTM
@KennyTM: I think the OP expects an error as he is using XHTML (cf. tags), and this doc type generally discourages layout information in the markup.
Jørn Schou-Rode
Then W3C validator isn't the right tool. It won't even reject the `<i>` tag because it is in the schema.
KennyTM
@Jørn XHTML doesn't discourage anything. It's a reformulation of HTML4 in XML. Separation of presentation and content is a design philosophy, not a W3C spec.
mercator
XHTML 1.0 is. XHTML 1.1 introduces some changes. *Some* of which are even documented in the Changes from XHTML 1.0 Strict section.
David Dorward
A: 

It seems that you are worrying about this because align is deprecated for the most of the html tags.

However, according to the W3C specification, align is OK for td tag, even when the DOCTYPE is strict.

See this link: http://www.w3schools.com/tags/tag_td.asp

Zenya
"Deprecated" is "Deprecated" and "Does not appear in Strict" is "Does not appear in Strict". They are not the same thing.
David Dorward
I think that in this particular case it is the same (see, for example, http://www.w3schools.com/tags/att_div_align.asp), isn't it? Correct me if I'm wrong. In any case, I deleted "provided that the DOCTYPE is strict" from the first sentence because this is not important here.
Zenya
Please, NEVER imply that w3schools is "the W3C specification".
DisgruntledGoat
A: 

If it's really a worry, could you not use CSS instead, so you have:

<td class="myclass">

and then some CSS to align it? Surely that's more acceptable to do then your example?

Liam
+4  A: 

OK Jitendra, you've posted dozens and dozens of very similar questions, asking about every minute aspect of HTML validation, deprecated tags and so on. You need to just stop worrying that one part validates or doesn't validate.

First, relying on a single metric (validation) for code quality is not good. Second, valid code is not always good code. You could nest 500 div tags with meaningless class names and it would validate, but it would still be horrible code.

Is validation bad? No, of course not. It can help pick out problems that may appear cross browser. Things like mis-typed attributes, certain unclosed tags (like divs). But for example using <br> instead of <br/> in an XHTML document doesn't matter - browsers treat them identically.

Please, go away and learn about the separation of HTML for content and CSS for presentation. Then you'll see how completely silly and obvious this question is. If the validator isn't complaining about some attributes, then that doesn't automatically mean they are great and should be used liberally.

Think about what they are doing. They are aligning content horizontally and vertically. That's a presentational issue, therefore, it is better to put them in CSS where possible. Stop relying on Stack Overflow members to tell you what is acceptable and what isn't, try using a little common sense.

Sorry for the rant, but I hope you can see my point and stop relying on the w3c validator for everything.

DisgruntledGoat