Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Are divs and spans allowed inside form elements?

Tags:

html

forms

I am asking this question to test the validity of my HTML. I can very well try this out (and I have, and it's possible), but I'm simply curious whether or not this is allowed in HTML. If not, how can one simulate a div or span element inside a form? Using blockquote?

like image 750
David G Avatar asked Aug 14 '11 23:08

David G


1 Answers

form is a block-level element in HTML. Typically, block-level elements allow both block-level and inline children. Both div and span are valid children of form.

There are a ton of resources online to learn more about this topic, for example:

http://www.w3.org/TR/html4/struct/global.html#h-7.5.3

It may also benefit you to read about the box model, as this is one of the most fundamental concepts of web design/development.

http://www.w3.org/TR/CSS2/box.html

like image 56
Jeremy Wiggins Avatar answered Oct 25 '22 09:10

Jeremy Wiggins