Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What's the best semantic way to wrap a search area?

I'd like to take advantage of the improved semantics of html5. I'm creating a search area, and the search area should have a background and contain search related things, like autocomplete and search hints.

Is there some consensus around what type of element something like a search area should be wrapped in?

  • Should it be a NAV because searching is a method of navigation?
  • Should it be a SECTION because it's a discreet section of the page?
  • Should it be a DIV because the wrapping of search related elements has no clear semantics?

The markup is something like this:

<?whatElement?>
  <input type="search" placeholder="Search for a name or ID..." required />
  <a href="#" class="search button">Search</a>
</?whatElement?>

Thanks for your thoughts.

like image 246
SimplGy Avatar asked Dec 22 '10 13:12

SimplGy


1 Answers

How about:

<form>
   <input type="search" name="" value="" />
   <input type="submit" value="Search" />
</form>
like image 182
antonj Avatar answered Sep 20 '22 11:09

antonj