HTML Reference Β· Sections
The <search> element
Reference for the HTML <search> element: wrapping search and filter controls, the search landmark, what it is not for, examples, browser support and details.
The <search> element wraps the controls for searching or filtering: a site search form, a product filter, or a "find on this page" box. It gives those controls a search landmark without any ARIA.
<search> <form action="/search"> <label for="q">Search recipes</label> <input id="q" name="q" type="search"> <button>Search</button> </form> </search>
Try it
Filtering happens on the page, so this <search> has no <form>. A server-side search would wrap a form instead, as in the first snippet.
Attributes
This element has no attributes of its own. It accepts the global attributes; add an aria-label when a page has more than one search region.
Usage notes
- Wrap the controls, not the results. The search results are ordinary content; put them in
<main>or a<section>, not inside<search>. - It is not a form.
<search>adds meaning only. If the search submits to a server, place a<form>inside it, withmethod="get"so results get a shareable URL. - Replaces
role="search". Before this element, authors wrote<form role="search">. Both expose the same landmark; the element is the cleaner choice in current browsers. - Label the input. Even a compact search box needs a
<label>(it can be visually hidden) or anaria-label.type="search"on the<input>adds a clear button in some browsers. See Input Types. - Not for every input. A newsletter sign-up or a login form is not search; don't wrap those.
Technical summary
| Content categories | Flow content, palpable content |
| Permitted content | Flow content |
| Tag omission | None; both the start and end tags are required |
| Permitted parents | Any element that accepts flow content |
| Implicit ARIA role | search |
| DOM interface | HTMLElement |
| Default display | block |
Browser support
<search> is Baseline 2023: supported in all current major browsers since late 2023. Older browsers treat it as an unknown inline element and don't expose the landmark; if you must support them, add role="search" to the element.
Related
<form>β submits the search to a server<input>β the search field<nav>β another landmark for finding your way- Lessons: Forms, Input Types, ARIA Roles, States and Properties