Uses

Search utilities are quite important for sites with large and vast amounts of content. Quite often, users do not like to try to find the content their looking for through a series of navigational menus, so they start off their exploration on a website through the use of search. Search allows the user to type in a keyword and view a listing of pages that include information relevant to that keyword. This can greatly increase the user experience and allow a user to quickly and efficiently find what they are looking for.

Styles

For the top site-wide search box, the box has a 1px solid #c8c8c8 border with a radius of 5px. The width of this field is 200px, however this is not an absolute.

For the interior page search box, The box has a 1px solid #ccc border with a radius of 3px.

Examples

This example shows two search boxes used on the School of Medicine site. The top search box is next to the School of Medicine logo. Because of its location being at the top of the site next to the main navigational elements, this indicates that this is a site-wide search. Below this section, there is another search field underneath the news menu options. This indicates the search will only search through news items.

Code

HTML
<form name="search" method="get" id="search-form" autocapitalize="none" action="https://medicine.wustl.edu/"> <p><label for="search-box">Search</label><br> <input type="text" id="search-box" name="s"> <button type="submit" class="submit" id="search-btn" onclick="document.getElementById('search-form').submit();"> <img alt="Search" src="https://medicine.wustl.edu/wp-content/themes/medicine/_/img/search.svg" > </button> </form>
CSS
*------------ Site-Wide Search ------------* #search-form { float: right; position: absolute; margin-right: 10px; width: 240px; top: 50%; margin-top: -18px; right: 0; } #search-form label { position: absolute; top: 10px; left: 10px; cursor: text; color: #6c7373; font-size: 14px; font-style: italic; font-weight: 600; letter-spacing: 1px; } textarea { border-radius: 5px; border: 1px solid #ccc; } #search-box { margin: 0; width: 200px; height: 17px; padding: 10px 30px 10px 10px; border: 1px solid #c8c8c8; outline: 0; border-radius: 5px; background: #fff; color: #3d3d3d; letter-spacing: 1px; font-size: 12px; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; } #search-btn { position: absolute; top: 50%; margin-top: -7px; padding: 0; right: 10px; cursor: pointer; border: 0; background: none; } #search-btn img { display: block; } *------------ Interior Page Search ------------* .news-filters .search { vertical-align: top; position: relative; } .news-filters .search-btn { display: none; position: absolute; right: 0; } .news-filters .search-btn img { padding: 10px 10px 10px 5px; display: block; cursor: pointer; } .news-filters .search-news { position: absolute; z-index: 5; right: 0; top: 0; background: #fff; border-radius: 3px; } .news-filters .search-news.open { display: block; } .news-filters .search-news input { margin: 0; padding: 8px 30px 8px 8px; width: 300px; /* Switch back to 387px when topics get added back in */ height: 21px; border-radius: 3px; outline: 0; font-family: "Source Sans Pro", "Helvetica Neue", Helvetica, Arial, sans-serif; border: 1px solid #ccc; -webkit-appearance: none; } .search-news p { position: relative; } .search-news p br { display: none; } .search-news label { position: absolute; top: 10px; left: 10px; z-index: 11; cursor: text; color: #bababa; font-style: italic; letter-spacing: 1px; font-size: 13px; } #search-btn-news { position: absolute; top: 50%; margin-top: -7px; padding: 0; right: 10px; cursor: pointer; border: 0; background: none; } #search-btn-news img { display: block; }