htmlsemanticsfooter

Is using <footer> inside <form> semantically fine?


I've been looking around to see if you can use footer like this:

<form>
   <input />
   <input />
  <footer>
   <input />
  </footer>
</form>

The way I see it, its meets the spec:

the footer element represents a footer for the section it applies to

Thoughts?


Solution

  • According to http://dev.w3.org/html5/markup/footer.html

    The footer element represents the footer for the section it applies to.

    Permitted contents
    Flow content

    According to http://dev.w3.org/html5/markup/terminology.html#flow-content

    flow content
    Flow content consists of flow elements intermixed with normal character data

    According to http://dev.w3.org/html5/markup/common-models.html#common.elem.flow

    7.1. Flow elements
    phrasing elements or a or p or hr or pre or ul or ol or dl or div or h1 or h2 or h3 or h4 or h5 or h6 or hgroup or address or blockquote or ins or del or object or map or noscript or section or nav or article or aside or header or footer or video or audio or figure or table or form or fieldset or menu or canvas or details

    7.3. Phrasing elements
    a or em or strong or small or mark or abbr or dfn or i or b or s or u or code or var or samp or kbd or sup or sub or q or cite or span or bdo or bdi or br or wbr or ins or del or img or embed or object or iframe or map or area or script or noscript or ruby or video or audio or input or textarea or select or button or label or output or datalist or keygen or progress or command or canvas or time or meter

    Input is a phrasing element, so yes you can.

    There are many online references where

    Footers usually/should contain information about it’s containing element.

    A footer typically contains the author of the document, copyright information, links to terms of use, contact information, etc.

    but the spec is more than that.