HTML and CSS Reference
In-Depth Information
figure 6-9
inserting field set legends
3. Save your changes to the file and then refresh the survey.htm file in your Web
browser. Figure 6-10 shows the current appearance of the form.
figure 6-10
viewing field sets and legends
field sets
legend
Field sets are block elements that expand to accommodate their content. The field sets
you added are currently empty, so they appear small and narrow on the survey page.
By default, browsers display the legend text in the upper-left corner of the field set box.
However, you can use CSS positioning styles to move the legend and format its appear-
ance. Next, you'll add control elements and other content to the two field sets.
Creating Input Boxes
Most of the control elements in which users either type or select a data value are marked
as input elements using the <input> tag
<input type=” type ” name=” name ” id=” id ” />
where type specifies the type of input control, the name attribute provides the name of
the field associated with the control element, and the id attribute identifies the control
element itself. When the form data is submitted to the server, the server program pairs the
field name with the field value; thus you almost always need a name attribute if you are
submitting the form to a server. The id attribute is required only when you need to refer-
ence the control element itself, as you might if you intend to apply a CSS style rule to
modify the appearance of the control element. In this tutorial, you'll supply both a name
and an id attribute for every control, and you'll set them to the same value.
HTML 4 supports 10 different input types, which are described in Figure 6-11; HTML5
adds 13 new input types that you'll explore later in this tutorial.
If no type attribute is
included, browsers assume
that an input control is a
text input box.
Search WWH ::




Custom Search