HTML and CSS Reference
In-Depth Information
The <textarea> element has two sizing attributes: cols for width in terms of the aver-
age character width and rows for height in terms of the number of lines of visible text. The
size of a textarea, however, is more commonly identified using the width and height
properties within CSS.
Multiple Choice Inputs & Menus
Apart from text-based input controls, HTML also allows users to select data using multiple
choice and drop-down lists. There are a few different options and elements for these form
controls, each of which has distinctive benefits.
Radio Buttons
Radio buttons are an easy way to allow users to make a quick choice from a small list of
options. Radio buttons permit users to select one option only, as opposed to multiple op-
To create a radio button, the <input> element is used with a type attribute value of ra-
dio . Each radio button element should have the same name attribute value so that all of
the buttons within a group correspond to one another.
With text-based inputs, the value of an input is determined by what a user types in; with ra-
dio buttons a user is making a multiple choice selection. Thus, we have to define the input
value. Using the value attribute, we can set a specific value for each <input> element.
Additionally, to preselect a radio button for users we can use the Boolean attribute
checked .
Click here to view code image
1. <input type="radio" name="day" value="Friday" checked > Friday
2. <input type="radio" name="day" value="Saturday" > Saturday
3. <input type="radio" name="day" value="Sunday" > Sunday
Figure 10.9 A group of radio buttons created by way of the <input> element with a
type attribute value of radio
Search WWH ::

Custom Search