This example shows a labeled dropdown to pick a pet. It uses accessible labels and simple styling. The dropdown is keyboard friendly and visually clear.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Select Dropdown Example</title>
<style>
body {
font-family: Arial, sans-serif;
padding: 2rem;
background-color: #f9f9f9;
}
label {
font-weight: 600;
margin-right: 0.5rem;
}
select {
padding: 0.4rem 0.6rem;
font-size: 1rem;
border: 1px solid #ccc;
border-radius: 0.3rem;
background-color: white;
cursor: pointer;
}
select:focus {
outline: 2px solid #007acc;
outline-offset: 2px;
}
</style>
</head>
<body>
<form>
<label for="pet-select">Choose a pet:</label>
<select id="pet-select" name="pets" aria-label="Choose a pet">
<option value="dog">Dog</option>
<option value="cat">Cat</option>
<option value="hamster">Hamster</option>
<option value="parrot">Parrot</option>
<option value="spider">Spider</option>
<option value="goldfish">Goldfish</option>
</select>
</form>
</body>
</html>