Forum Moderators: open

Message Too Old, No Replies

Why use labels

         

bleak26

7:33 pm on Mar 6, 2007 (gmt 0)

10+ Year Member



Hi
I saw this on w3schools and wondered for what reason that labels should be used. It does help us comply with wia standards, but what does it alow me to do, Which just typing my own label does not.

<html>
<body>
<label for="lname">Last Name:</label>
<input type="text" name="lastname" id="lname" />
</body>
</html>

SuzyUK

7:59 pm on Mar 6, 2007 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



if you click on the label it will put your focus/cursor into the relevant input box

you could nest the input inside the label to give it a wider focus

<label for="lname">Last Name: <input type="text" name="lastname" id="lname" /> </label>

now imagine if that label was made into display: block it gives a much wider area for accessibility! IMHO It's the right tool for the job ;)

Suzy