Forum Moderators: open
Document type does not allow element "blah" here; missing one of "p", "h1", "h2", "h3", "h4", "h5", "h6", "div", "pre", "address", "fieldset", "ins", "del" start-tag
This happens if I do the following:
<div>
<form>
Some text:<br />
<input><br />
</form>
</div>
However, if I change it to:
<div>
<form>
<div>
Some text:<br />
<input><br />
</div>
</form>
</div>
... then it passes a happy validator.
Can someone tell me why it's so wrong to do what I did in the first example? Or, is it just that W3C is trying to tell me that, "hey, you didn't include that section in a paragraph or equivalent block." I can understand that much... it's good style to use paragraphs etc. But it's already in a div, and that is a valid block ...
Oh well :)
I've also noticed that, in some browsers at least, form tags are the first to "disappear" when a link is clicked - they're off the screen long before the other page elements vanish.
So when the W3C says that forms in XHTML can't include any "bare naked" text, my guess is that it falls into this realm.
I doubt that I'll ever write a browser...that's just not my thing. But in the drive for a well formed language, I have been growing a sense of trust for why these rules need to be the way they are.
What I mean, though, is that even though these rules are there for a reason, it sure doesn't make it any easier for us as developers. Certain things don't make sense. But, then again .. if you always follow good practise (by putting all content in paragraphs) then you won't have a problem at all ..
But, it takes a major change of mind, a new way of thinking. I've said it before, but I like to repeat myself:
Think content! Content first, layout next. And that is "next" as in layout after you've added the content, not before or during.