From df3a4db5baac51276a8281bb66e0fcced16b8225 Mon Sep 17 00:00:00 2001 From: Parul Date: Sun, 10 Mar 2019 12:25:18 -0400 Subject: [PATCH] Added info on label element (#30506) * Added info on label element Added information on the label element of a form and how to use the label element with a particular input element. * Capitalization --- guide/english/css/forms/index.md | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/guide/english/css/forms/index.md b/guide/english/css/forms/index.md index eb74c3d706..d909c39a82 100644 --- a/guide/english/css/forms/index.md +++ b/guide/english/css/forms/index.md @@ -50,7 +50,16 @@ It is the most important form element. Different types of input element are: ``` -### The NAME attribute +### The label Element +The label element is used to add a label for an input element. The label element has a `for` attribute, whose value is set to be the same as the `id` attribute of the input element - doing this associates the label element with the input element. + +Here is an example of using the label element with an input element: +```html + + +``` + +### The name attribute If you want to submit the form that the input fields must contain the name attribute,if it is not present, the data of that input field will not be sent at all. In the below given example,only input type corresponding to first name will be submitted. @@ -62,7 +71,8 @@ In the below given example,only input type corresponding to first name will be s ``` -## Style input element with css + +## Style input element with CSS ### :focus selector The `:focus` selector is applied when the element accepts user inputs. @@ -72,7 +82,3 @@ input:focus { background-color: #FFFF66; } ``` - - - -