Reputation: 555
I want to give ListBox width in HTML5. Please give me some idea.
Upvotes: 0
Views: 6703
Reputation: 5131
CSS
#example {
width: 300px;
}
HTML
<select size="4" id="example" name="example">
<option selected>Fries</option>
<option>Drink</option>
<option>Pie</option>
<option>Salad</option>
<option>Shake</option>
</select>
For completeness and to show an actual HTML5 Listbox (no JS needed).
Upvotes: 0
Reputation: 47687
You can style it as a regular input - all CSS properties applicable to it
CSS
input[list] {
width: 300px;
}
HTML
<input type="text" list="browsers" />
<datalist id="browsers">
<option> Chrome </option>
<option> Firefox </option>
<option> IE9 </option>
</datalist>
Upvotes: 1