Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

16. Forms > Creating Select Boxes

Creating Select Boxes

Select boxes are perfect for offering your visitors a choice from a given set of options. They are most often rendered as drop-down lists. If you give the user the option to select multiple answers, the select box will render as a box of items with a scroll bar Image.

Image Select boxes are made up of two HTML elements: select and option. You set the common name attribute in the select element, and you set the value attribute in each of the option elements.


<label for="state">State:</label>
<select id="state" name="state">
     <option value="AL">Alabama</option>
     <option value="AK">Alaska</option>
     ...
</select>


Image We’ll use CSS again to adjust the font size. You can adjust the width, color, and other attributes using CSS, but each browser displays drop-down lists slightly differently.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial


  
  • Safari Books Online
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint