22.04.2013 Views

HTML, XHTML & CSS

HTML, XHTML & CSS

HTML, XHTML & CSS

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Chapter 14: Working with Forms<br />

✓ By default, the browser displays only one option until the user clicks the<br />

drop-down menu arrow to display the rest of the list. Use the size attribute<br />

with the tag to specify how many options to show.<br />

If you specify fewer than the total number of options, the browser<br />

includes a scroll bar with the drop-down list.<br />

Figure 14-10: A drop-down list.<br />

You can specify that one of the options in the drop-down list be already<br />

selected when the browser loads the page, just as you can specify a check<br />

box or radio button to be checked. Simply add the selected attribute to<br />

have a value of selected for the tag you want as the default. Use<br />

this when one choice is very likely, but don’t worry — users can override<br />

your default selection quickly and easily.<br />

The following markup example<br />

✓ Allows the user to choose more than one option from the list<br />

✓ Displays two options<br />

✓ Selects the third option in the list by default<br />

<br />

What are some of your favorite foods?<br />

<br />

Pizza<br />

Ice Cream<br />

Green Eggs and Ham<br />

<br />

<br />

235

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!