👀 Live Preview
The modern way to add search—a labeled <form> with type="search":

By the end of this tutorial, you’ll understand the historical <isindex> search field and what to use instead in modern HTML.
How <isindex> created a single-line query field without a <form>.
Understand legacy prompt and action from early HTML.
Why <isindex> was removed from HTML5.
Compare the legacy tag with modern <form> and <input>.
Build search UI with type="search", labels, and buttons.
Labels, focus states, and keyboard-friendly search forms.
<isindex> Tag?The <isindex> element was an early HTML feature that rendered a single-line text field for searching within a document. Authors placed it in the <head> or <body>, and pressing Enter submitted the query to the server.
Do not use <isindex> in new projects. It was deprecated in HTML 4.01 and removed from HTML5. Modern browsers ignore it. Use a <form> with an <input type="search"> instead.
In the early web, <isindex> offered a quick way to add document search without building a full form. Today the same goal is met with semantic forms that support labels, validation, styling, and accessibility.
<form action="/search" method="get" role="search">
<label for="q">Search:</label>
<input type="search" id="q" name="q" placeholder="Enter search query">
<button type="submit">Search</button>
</form>Legacy HTML placed <isindex> in the document with an optional prompt attribute:
<isindex prompt="Enter search query:"><isindex> had no closing tag and no inner content.head or body in very old HTML documents.| Topic | Legacy (isindex) | Modern replacement |
|---|---|---|
| Search field | <isindex prompt="Search:"> | <input type="search"> |
| Prompt text | prompt attribute | <label> or placeholder |
| Submit target | action attribute | <form action="/search"> |
| Submit control | Enter key only | <button type="submit"> |
| Status | Obsolete | HTML5 standard |
| Accessibility | No proper label API | label, aria-label, focus styles |
<isindex> vs <form> + <input>Modern search forms replace every limitation of the legacy tag:
| Feature | <isindex> | <form> + <input> |
|---|---|---|
| Status | Obsolete, removed from HTML5 | Standard HTML5 |
| Visible label | prompt text only | <label for="id"> |
| Input types | Single text line | search, text, and more |
| Submit button | Not available | <button type="submit"> |
| Validation | None | required, pattern, Constraint Validation API |
| Styling | Browser-controlled only | Full CSS control |
<!-- Legacy (do not use) -->
<isindex prompt="Search this site:">
<!-- Modern replacement -->
<form action="/search" method="get" role="search">
<label for="site-search">Search this site:</label>
<input type="search" id="site-search" name="q">
<button type="submit">Search</button>
</form>Very old browsers recognized these attributes on <isindex>:
prompt ObsoleteText displayed before the search input as a hint or instruction.
prompt="Search this site:"action ObsoleteURL where the query string was sent when the user pressed Enter.
action="/cgi-bin/search"<isindex
prompt="Enter your search term:"
action="/search"
>All isindex attributes are historical only. The entire element is obsolete and ignored by modern browsers.
Historical isindex patterns plus modern search forms. Legacy examples are for learning only—they will not render in current browsers.
The modern way to add search—a labeled <form> with type="search":
How <isindex> looked with a prompt. For learning only—modern browsers ignore it.
<isindex prompt="Search this site:">In early HTML, authors used <isindex> for simple document or site search. Today the same goals are met with accessible <form> elements and server-side or client-side search logic.
Some legacy pages placed <isindex> inside <head>. Browsers that supported it rendered a search field on the page.
<!DOCTYPE html>
<html>
<head>
<title>Example of isindex</title>
<isindex prompt="Enter your search term:">
</head>
<body>
<p>This page demonstrates the obsolete <code><isindex></code> tag.</p>
</body>
</html>This is what beginners should use today. A visible label, search input, and submit button give users full control.
<form action="/search" method="get" role="search">
<label for="search">Search:</label>
<input type="search" id="search" name="q" placeholder="Enter search query">
<button type="submit">Search</button>
</form>For instant feedback, listen to input events on a search field. Open the browser console (F12) to see logged queries.
<form id="searchForm" role="search">
<label for="search">Search:</label>
<input type="search" id="search" name="q" placeholder="Enter search query">
<button type="submit">Search</button>
</form>
<script>
document.getElementById("search").addEventListener("input", function (e) {
console.log("Searching for: " + e.target.value);
});
</script>Unlike <isindex>, modern forms can be styled fully. Customize search fields for your site design:
border-radius Rounded search bar:focus Visible focus ringflex Inline search + button::placeholder Hint text styling/* Accessible search form layout */
form.search-bar {
display: flex;
gap: 0.5rem;
max-width: 420px;
}
form.search-bar input[type="search"] {
flex: 1;
padding: 0.5rem 0.75rem;
border: 1px solid #cbd5e1;
border-radius: 8px;
}
form.search-bar input[type="search"]:focus {
outline: 2px solid #2563eb;
outline-offset: 2px;
}
form.search-bar button {
padding: 0.5rem 1rem;
border: none;
border-radius: 8px;
background: #2563eb;
color: #fff;
}Live styled search
Modern search forms fix the accessibility gaps of <isindex>:
<label for="id"> to the search input; do not rely on placeholder text alone.role="search" — on the <form> so assistive tech identifies the region as site search.Place the tag in head or body with optional prompt text.
Supporting browsers showed a single-line input for the user’s query.
Pressing Enter sent the value to the URL in action or the current document.
Learn isindex for history. Build real search UI with <form> and <input type="search">.
<isindex> is obsolete and not part of HTML5. Modern browsers do not render a search field from this tag.
Chrome, Firefox, Safari, Edge, and Opera ignore <isindex>. Only very old browsers may have rendered a search field. Do not use this tag in new documents.
Use these HTML5 approaches instead of isindex.
Bottom line: Do not use <isindex> in new projects. Use <form> with <input type="search"> instead.
The <isindex> tag is a relic of early HTML—useful to recognize in archived pages, but not for new sites. Beginners should learn <form>, <label>, and <input type="search"> for all search interfaces, with proper accessibility and styling.
<form role="search"> for site search<label>type="search" for search-specific keyboard hintsisindex only to read legacy HTML<isindex> in any new HTML code<isindex>Bookmark these before you ship — they’ll keep your search UI modern and accessible.
<isindex> was removed from HTML5—do not use it in new code.
It rendered one text field for document search in very old browsers.
Behaviorprompt showed helper text before the legacy input.
<form> + <input type="search"> is the standard replacement.
Modern forms need visible labels—not just prompt text.
AccessibilityChrome, Firefox, Safari, Edge, and Opera do not render isindex.
Compatibility<form> with an <input type="search">, a <label>, and a submit button.prompt set helper text before the field. action set the URL that received the query. Both are obsolete.<isindex>.<form> and <input> for real projects.Skip deprecated isindex. Practice accessible search forms with form and input in the Try It editor.
6 people found this page helpful