HTML forms II

Derek Bridge

Department of Computer Science,
University College Cork

HTML forms II

Aims:

Accessibility

Accessibility: the title attribute

Accessibility: the placeholder attribute

Accessibility: the label element

Accessibility: the for attribute

Breaks, paragraphs, lists, tables, or divs?

Accessibility: the fieldset and legend elements

Accessibility: example 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>

Accessibility: the accesskey attribute

Accessibility: the accesskey attribute

CSS for forms

label
{
    float: left;
    width: 10em;
}

form div
{
    clear: left;
} 

Prettifying a form