Definition
<label> tag는 몇몇의 element들을 위해 label을 정의하는 역할을 합니다.
<label> tag를 적용 가능한 항목은 아래와 같습니다.
- <input type="checkbox">
- <input type="color">
- <input type="date">
- <input type="datetime-local">
- <input type="email">
- <input type="file">
- <input type="month">
- <input type="number">
- <input type="password">
- <input type="radio">
- <input type="range">
- <input type="search">
- <input type="tel">
- <input type="text">
- <input type="time">
- <input type="url">
- <input type="week">
- <meter>
- <progress>
- <select>
- <textarea>
Example Code
<!DOCTYPE html>
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>label tag test</title>
</head>
<body>
<form>
<fieldset>
<label>이메일<input type="email"></label>
</fieldset>
<fieldset>
<label for="email_id">이메일</label>
<input type="email" id="email_id">
</fieldset>
</form>
</body>
</html>
Result

Reference
'Study > HTML' 카테고리의 다른 글
<input> tag (0) | 2021.10.04 |
---|---|
<fieldset> tag (0) | 2021.10.04 |
<form> tag (0) | 2021.10.04 |
기본구조 (0) | 2021.10.04 |