fs_tigre — 2011-02-12T08:20:00-05:00 — #1
The more I read about HTML and CSS the more I know how much I dont know. I was trying to incorporate a search box in one of my sites and I was searching on the internet to see what was the most appropriate way to create this and to my surprise I came across a tutorial that actually show the input field surrounded with a "p" tag. Something like this...
<form action=" method="get">
Can the P tag hold other than just text elements? If yes, when would you do this and why?
Thanks a lot!
xhtmlcoder — 2011-02-12T09:21:00-05:00 — #2
Yes, the P element can contain other elements as it is block-level, for example P can contain the inline SPAN. Albeit I think you were actually asking why is there a P as a direct descendant of the FORM in that example?
Well, I'd say probably because they (see example post #1) aren't bothered about semantics. It's not a very good use of semantics I suspect they didn't even use LABEL in the full form, etc.
victorinox — 2011-02-12T09:37:19-05:00 — #3
The main restriction is that paragraphs should not contain block-level elements.
See the HTML 4.01 spec
fs_tigre — 2011-02-12T11:33:33-05:00 — #4
xhtmlcoder — 2011-02-12T14:36:55-05:00 — #5