Aims:
title
attributetitle
attribute, so that a tooltip appears
when the user hovers over the field
<input type="text" name="zip" title="A valid US zip code or UK postcode. For other countries, leave blank." />
placeholder
attributeplaceholder
attribute<input type="text" name="firstname" placeholder="Your first name" />
value
attribute (from previous lecture)
label
elementSurname: <input type="text" name="surname" />
label
tag:<label>Surname:</label>
<input type="text" name="surname" />
for
attributeid
attribute on the control (we'll use the same value
as the name
but they're different things)
for
attribute on the label
<label for="surname">Surname:</label>
<input type="text" name="surname" id="surname" />
name
and id
attributes?
div
s?br
after each one?p
?li
within a ul/ol
?td
within a tr
within a table
?div
?fieldset
and legend
elementsform
element, group together related controls
inside a fieldset
elementlegend
element nested in the fieldset
to describe the group of controls
fieldset
and legend
elements<form action="process.php" method="get> <fieldset> <legend>Customer Details</legend> <div> <label for="firstname">First name:</label> <input type="text" name="firstname" id="firstname" /> </div> <div> <label for="surname">Surname:</label> <input type="text" name="surname" id="surname" /> </div> </fieldset> <fieldset> <legend>Billing Address</legend> ... </fieldset> ... </form>
accesskey
attributeinput
element has an accesskey
attribute
<input type="text" name="firstname" accesskey="f" />
<input type="text" name="surname" accesskey="s" />
accesskey
attribute<div> <label for="firstname"> <span class="shortcut">F</span>irst name: </label> <input type="text" name="firstname" id="firstname" /> </div>(
span
is used to markup a phrase when other tags such as
em
i
, strong
, b
, etc.
aren't right)
.shortcut { text-decoration: underline; }
div
to ensure it starts below the previous floated
label
label { float: left; width: 10em; } form div { clear: left; }
div
text-align: right
on the labels