Labels, Textareas
Labels
You can add labels to your form, and attach them to a specific text box or other form element. They are good when you have small elements like check boxes, as you can click on the label to select the check box.
To add a label a pair of LABEL tags are used:
To attach a label to a particular form element the FOR attribute is used, followed by the ID of the form element you want to attach it to. For example, examine the code below:
<LABEL FOR="tb1">First Name: </LABEL>
<INPUT ID="tb1" TYPE="Text" Value="Enter your first name" NAME="textBox1">
In the code above, the LABEL is FOR a form element with the ID "tb1". Here's what it looks like in the
TEXTAREA
If you want a bigger text box, for people to leave comments for example, then you can use the TEXTAREA tag.
Textarea doesn't use the INPUT tag. And you need an end Textarea tag, as well. After typing a space, you specify how big your Textarea is going to be. You do this with the ROWS and COLS attributes. The Height equates to Rows, and the Width to Cols (not Columns):
<TEXTAREA ROWS="7" COLS="30" NAME="TextArea1" ID="TA1">
Default text area
</TEXTAREA>
The text area above would then look like this in Firefox version 4 and later:
You can also attach a label to the Textarea. You do it in exactly the same way as for text boxes:
<LABEL FOR="TA1">Comments:</LABEL>
<TEXTAREA ROWS="7" COLS="30" NAME="TextArea1" ID="TA1">
Default text area
</TEXTAREA>
Exercise
Add a Textarea to your own form. Apply some CSS styling to liven it up a little.
Friday, 10 July 2015
Labels, Textareas
<LABEL>Label Text Here</LABEL>
The text you want to go on the label goes between the two tags.
<TEXTAREA ROWS="7" COLS="30" NAME="TextArea1" ID="TA1">
</TEXTAREA>
If you want some default text to appear in the Textarea then you can type it between the two tags:
0 comments:
Post a Comment