HTML Search Regions: Native Search Landmarks
Mark a search region
The search element identifies controls used to search or filter content. It exposes a search landmark in supporting browsers. The input element below is a text-entry control, and label gives it a visible name through a matching for and id. Form controls are introduced here only to illustrate the region; their submission behavior is taught in the next chapter.
<search> <label for="query">Find a book</label> <input id="query" type="search"></search>The control accepts text; this structural example does not perform a search.
Separate the controls from results
Search controls and search results serve different purposes. Keep results in the appropriate content region, rather than wrapping an entire result page in search. The search element does not provide a search engine or automatically filter items. The example shows a static result list, not a functioning filter.
<header> <search aria-label="Catalog"> <label for="catalog-query">Book title</label> <input id="catalog-query" type="search"> </search></header><main> <h1>Results</h1> <ul> <li>Web basics</li> <li>Garden guide</li> </ul></main>The named search region is separate from the static results in main.
Name separate search tools
If a page has different search tools, give each region a distinct accessible name. aria-label supplies a name directly; the input labels are still needed to describe their individual controls. For older environments without native search support, a div with role="search" is an alternative. Do not add a redundant role to native search without a specific compatibility reason.
<search aria-label="Site"> <label for="site-q">Search site</label> <input id="site-q" type="search"></search><search aria-label="Help center"> <label for="help-q">Search help</label> <input id="help-q" type="search"></search>Two search landmarks are distinguishable by name; neither runs a query by itself.
Common mistakes and practice
Use search for searching or filtering, not for unrelated forms. Do not confuse input type="search" with a search landmark. Test native landmark support in target environments. Actual query submission and filtering require application logic.
Check Your Understanding
Solidify your learning with the interactive assessment directly below this lesson.
Concept Quiz & Questions
HTML Search Regions: Native Search Landmarks — Knowledge Check
Apply the semantic HTML and page structure concepts from this lesson.
What does the search element provide on its own?
Where should ordinary search results usually appear?
Which markup can name a search region without visible heading text?
Does wrapping an input in search implement a search engine?
What should an input in a search region have independently of the region's name?