<form> inside <span>?

M

Michael

Am I allowed to do: <span><form ..>...</form></span> or will certain
browsers choke?

Thanks
 
B

Beauregard T. Shagnasty

Michael said:
Am I allowed to do: <span><form ..>...</form></span> or will certain
browsers choke?

<span> is an inline element and can only contain .. well .. inline
things. <form> is block-level element.

You could put a form inside a <div>, but it would help to know the
reason you want to do this. URL of page?

This will help:
http://validator.w3.org/
 
R

Rob McAninch

<span> is an inline element and can only contain .. well ..
inline things. <form> is block-level element.

You could re-style form as display:inline or try using the input
without form...
You could put a form inside a <div>, but it would help to know
the reason you want to do this. URL of page?

Yes, knowing what the objective is would help:)
 
M

Michael Winter

[...] Rob McAninch <[email protected]> spouted in alt.html:
[snip]
or try using the input without form...

Also not valid.

It would be valid. It might be pointless, but it would be valid. Form
controls can be inserted outside a FORM element, in pretty much any
location an in-line element can exist.

[snip]

Mike
 
R

Rob McAninch

Rob said:
in said:
Michael wrote:

Am I allowed to do: <span><form ..>...</form></span> or
will certain browsers choke?

<span> is an inline element [...] <form> is block-level
element.

You could re-style form as display:inline

form { display: inline; }

That's the idea if you want to dispense with the span and treat
form as inline. Using form within span; you already pointed out
was invalid.
and defeat the general purpose of having a form...

INPUT is generally found in a form, but isn't required to be.
Depending on the op's purpose this is an option.
 
M

Michael

Thanks a lot. I never thought of having the code validated at the link
you've posted. Makes sense!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top