Search code examples
htmlsemantic-markup

Can a form be used inside a figure element


Quick question: Can a <form> be used inside a <figure> element? I'm thinking a contact form, for example, would be

"self-contained,[... is] as a single unit from the main flow of the document, and [...] can be moved away from the main flow of the document without affecting the document’s meaning."-[<figure> spec]

code snippet:

<figure>
    <figcaption>Contact Us</figcaption>
    <form>
        <input name="email"...
        <textarea name="comments"...
        <input type="submit"...
    </form>
</figure>

Thoughts?


Solution

  • Yes, you are technically allowed to do that. If it is semantically correct in your case, that is another question (and I would probably disagree with it).

    Why it is technically allowed:

    In the link to the HTML5 figure spec you posted yourself, you will see:

    Permitted contents: One figcaption element, followed by flow content

    And since a <form> element is considered a flow element, you are good.