HTML Dog
Skip to navigation

Select boxes

Basic use of select and option elements.

HTML

<!DOCTYPE html>
<html>
<head>
	<meta charset="utf-8">
	<title>Select menus</title>
	<style>
		body {
			font: 100% arial, helvetica, sans-serif;
		}

		fieldset {
			padding: 0 1em 1em 1em;
		}

		legend {
			padding: 1em;
		}
	</style>
</head>
<body>
	<form action="someplace.php">
		<fieldset>
			<legend>Favourite book</legend>
			<label for="book">Name: </label>
			<select name="book" id="book">
				<option>The Trial</option>
				<option>The Outsider</option>
				<option>Things Fall Apart</option>
				<option>Animal Farm</option>
			</select>
		</fieldset>
	</form>

	<!-- Link back to HTML Dog: -->
	<p><a href="http://www.htmldog.com/examples/"><img src="http://www.htmldog.com/badge1.gif" alt="HTML Dog"></a></p>
</body>
</html>

Output

View original