Removed duplicate text and corrected formatting (#23433)
There were two descriptions of what a <label> is. Markdown formatting was incorrectly rendering in https://guide.freecodecamp.org/html/elements/label-tag.
This commit is contained in:
@ -3,23 +3,23 @@ title: Label Tag
|
|||||||
---
|
---
|
||||||
|
|
||||||
# Label Tag
|
# Label Tag
|
||||||
<***label***> defines a label for an <input> type element/tag.
|
<***label***> defines a label for an `<input>` type element/tag.
|
||||||
|
|
||||||
### Usage
|
### Usage
|
||||||
```
|
```
|
||||||
<label for="id">Label</label>
|
<label for="id">Label</label>
|
||||||
<input type="text" name="text" id="id" value="yourvalue"><br>
|
<input type="text" name="text" id="id" value="yourvalue"><br>
|
||||||
```
|
```
|
||||||
As you can see, the *for* attribute of the <label> tag should be equal to the id attribute of the related element to bind them together.
|
As you can see, the *for* attribute of the `<label>` tag should be equal to the id attribute of the related element to bind them together.
|
||||||
|
|
||||||
### Platform Support
|
### Platform Support
|
||||||
|Browser|Element Support|
|
|Browser|Element Support|
|
||||||
|:-----:|:-------------:|
|
|:-----:|:-------------:|
|
||||||
|Internet Explorer|:white_check_mark:|
|
|Internet Explorer|Yes|
|
||||||
|Mozilla Firefox|:white_check_mark:|
|
|Mozilla Firefox|Yes|
|
||||||
|Google Chrome|:white_check_mark:|
|
|Google Chrome|Yes|
|
||||||
|Opera|:white_check_mark:|
|
|Opera|Yes|
|
||||||
|Safari|:white_check_mark:|
|
|Safari|Yes|
|
||||||
|
|
||||||
### Attributes
|
### Attributes
|
||||||
|Attribute| Value|Description|
|
|Attribute| Value|Description|
|
||||||
@ -36,30 +36,6 @@ The <**label**> tag supports the Event Attributes in HTML.
|
|||||||
|
|
||||||
> The <**label**> element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the <label> element, it toggles the control.
|
> The <**label**> element does not render as anything special for the user. However, it provides a usability improvement for mouse users, because if the user clicks on the text within the <label> element, it toggles the control.
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#### More Information:
|
#### More Information:
|
||||||
[https://www.w3schools.com/jsref/dom_obj_label.asp](https://www.w3schools.com/jsref/dom_obj_label.asp)
|
[MDN - Label Tag](https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label)
|
||||||
=======
|
[W3School - Label Tag](https://www.w3schools.com/tags/tag_label.asp)
|
||||||
|
|
||||||
## Label
|
|
||||||
The `<label>` tag defines a label for an `<input>` element.
|
|
||||||
|
|
||||||
A label can be bound to an element either by using the "for" attribute, or by placing the element inside the <label> element.
|
|
||||||
```html
|
|
||||||
<label for="peas">Do you like peas?
|
|
||||||
<input type="checkbox" name="peas" id="peas">
|
|
||||||
</label>
|
|
||||||
```
|
|
||||||
|
|
||||||
```html
|
|
||||||
<label>Do you like peas?
|
|
||||||
<input type="checkbox" name="peas">
|
|
||||||
</label>
|
|
||||||
```
|
|
||||||
|
|
||||||
#### More Information:
|
|
||||||
|
|
||||||
|
|
||||||
<a href='https://developer.mozilla.org/en-US/docs/Web/HTML/Element/label' target='_blank' rel='nofollow'>MDN - Tabel Tag</a>
|
|
||||||
<a href='https://www.w3schools.com/tags/tag_label.asp' target='_blank' rel='nofollow'>W3School - Label Tag</a>
|
|
||||||
|
Reference in New Issue
Block a user