[ Web Proxy ]
URL:
Viewing: https://developer.mozilla.org/ko/docs/Web/HTML/Reference/Elements/label [Back]  [Original]

<label> - HTML: Hypertext Markup Language | MDN

This page was translated from English by the community. Learn more and join the MDN Web Docs community.

View in English Always switch to English

<label>

Baseline Widely available

This feature is well established and works across many devices and browser versions. Its been available across browsers since 2015 7.

HTML <label> .

In this article

<div class="preference">
  <label for="cheese">Do you like cheese?</label>
  <input type="checkbox" name="cheese" id="cheese" />
</div>

<div class="preference">
  <label for="peas">Do you like peas?</label>
  <input type="checkbox" name="peas" id="peas" />
</div>
.preference {
  display: flex;
  justify-content: space-between;
  width: 60%;
  margin: 0.5rem;
}

<label> <input> :

  • label . , (screenreader) (form input) label (assistive technology) .
  • label input . () (hit area) .

<label> <input> , <input> id . <label> id for .

, <label> <input> . for id .

html
<label
  >Do you like peas?
  <input type="checkbox" name="peas" />
</label>

:

  • label (form control) labeled control . input label .
  • (form control) <label> , label click control .

.

for

<label> , form-related id. , for id label * (labeled control)* . label for . id .

: <label> for control . for control .

form

label <form> ( form owner). , <form> id. label .

CSS

<label> . <span> <a> }}. .

label

html
<label>Click me <input type="text" /></label>

"for"

html
<label for="username">Click me</label> <input type="text" id="username" />

Don't place interactive elements such as anchors or buttons inside a label. Doing so makes it difficult for people to activate the form input associated with the label.

label anchors buttons . label .

html
<label for="tac">
  <input id="tac" type="checkbox" name="terms-and-conditions" />
  I agree to the <a href="terms-and-conditions.html">Terms and Conditions</a>
</label>

html
<label for="tac">
  <input id="tac" type="checkbox" name="terms-and-conditions" />
  I agree to the Terms and Conditions
</label>
<p>
  <a href="terms-and-conditions.html">Read our Terms and Conditions</a>
</p>

<label> . label , <label> CSS .

(form) <fieldset> <legend> .

html
<label for="your-name">
  <h3>Your name</h3>
  <input id="your-name" name="your-name" type="text" />
</label>

html
<label class="large-label" for="your-name">
  Your name
  <input id="your-name" name="your-name" type="text" />
</label>

type="button" value <input> . . <button> .

, , , , .
. , <label> . .
, .
.
ARIA
DOM HTMLLabelElement

Specification
HTML
# the-label-element


Web Proxy Viewer  |  New URL  |  Original Page