• 회원가입
  • 로그인
  • 구글아이디로 로그인

[form] HTML - <legend> 태그 - fieldset제목/설명 (= legend태그 = 레전드태그) (HTML5수정)

목차
  1. <legend> 예제 - fieldset 제목/설명 달기
  2. <legend> 정의
  3. <legend> 속성
  4. <legend> 예제 - float:right 사용 시, fieldset 내부 우측으로 이동
  5. <legend> 예제 - CSS 사용해 fieldset, legend 스타일 지정
  6. <legend> 기본 CSS

 

<legend> 예제 - fieldset 제목/설명 달기

 

<form>
    <fieldset>
        <legend>개인정보</legend>

        이름: <input type="text"><br>
        별명: <input type="text"><br>
        메일: <input type="text">
    </fieldset>

</form>


결과보기 

 

<legend> 정의

 

<fieldset> 태그로 묶은 요소들에 대한 제목이나 설명을 붙일 때 사용.

 


 

1.

  • HTML5 경우 align 속성 제외. CSS로 대체.
  • <legend> 태그의 위치 변경은 position 속성 대신 margin 속성 이용.
  • float 속성 사용 시, 제목이 fieldset 상자 안에 배치됨.

 

2.

모든 브라우저 지원.

 

 

<legend> 속성

   속성
  속성값   설명   비고
 
 align

 top
 bottom
 left
 right
 설명을 어느 쪽에 붙일 것인지 정함.  HTML5제외
<legend> 태그는 전역속성・이벤트속성 지원.
 

<legend> 예제 - float:right 사용 시, fieldset 내부 우측으로 이동

 

<form action="/action_page.php">

 <fieldset>

  <legend style="float:right">개인정보</legend>

  <label for="name">이름:</label>

  <input type="text" id="name" name="name"><br><br>

  <label for="email">이메일:</label>

  <input type="email" id="email" name="email"><br><br>

  <label for="birthday">생년월일:</label>

  <input type="date" id="birthday" name="birthday"><br><br>

  <input type="submit" value="확인">

 </fieldset>

</form>

 

결과보기

 

<legend> 예제 - CSS 사용해 fieldset, legend 스타일 지정

 

<style>

fieldset {background-color: lightgray;}

legend {background-color: gray; color: white; padding: 5px 10px;}

input {margin: 5px; padding:5px 10px}

</style>


<form action="/action_page.php">

 <fieldset>

  <legend>개인정보</legend>

  <label for="name">이름:</label>

  <input type="text" id="name" name="name"><br><br>

  <label for="email">이메일:</label>

  <input type="email" id="email" name="email"><br><br>

  <label for="birthday">생년월일:</label>

  <input type="date" id="birthday" name="birthday"><br><br>

  <input type="submit" value="확인">

 </fieldset>

</form>

 

결과보기

 

<legend> 기본 CSS


<style>
legend {
    display: block;
    padding-left: 2px;
    padding-right: 2px;
    border: none;
}
</style>



분류 제목
attribute HTML - for 속성 - <label>/<output> 관련 요소 ID 바인딩 지정 (= for속성 = …
attribute HTML - novalidate 속성 - 폼데이터 제출 시, 유효성 평가 생략 (= novalidate속성 …
attribute HTML - ontimeupdate 속성 - (오디오/비디오) 재생위치 변경 시 실행 (= ontimeupd…
attribute HTML - onwheel 속성 - 마우스휠/터치패드휠 움직일 때 실행 (= onwheel속성 = 온휠속성…
attribute HTML - border 속성 - (HTML5 지원 X) 테두리 너비 지정 (= border속성 = 보더속성…
attribute HTML - value 속성 ★★★ - 요소값 지정 (= value속성 = 밸류속성) ※ 초기값/기본값/현재…
attribute HTML - contenteditable 속성 - 요소 내용 수정 가능 여부 지정 (= contentedit…
attribute HTML - formtarget 속성 - 폼데이터 전달할 폼 지정 (= formtarget속성 = 폼타겟속성…
attribute HTML - dirname 속성 - input/textarea 요소의 텍스트 방향 지정 (= dirname속…
attribute HTML - onscroll 속성 ★ - 마우스 스크롤 이벤트 시 실행 (= onscroll속성 = 온스크롤…
attribute HTML - onpaste 속성 - 사용자가 요소에 내용 붙여넣기 시 실행 (= onpaste속성 = 온패스…
attribute HTML - usemap 속성 - 이미지를 이미지맵으로 지정 (= usemap속성 = 유즈맵속성|유스맵속성)
attribute HTML - class 속성 ★★★ - 클래스명 선택자 지정 (= class속성 = 클래스속성)
attribute HTML - bgcolor 속성 - (HTML5 지원 X) 배경색 지정 (= bgcolor속성 = 비지컬러속…
attribute HTML - onfocus 속성 ★ - 포커스 설정 시 실행 (= onfocus속성 = 온포커스속성) ※ o…
attribute HTML - data 속성 - <object> 태그의 리소스 URL 주소 지정 (= data속성 = 데이터속…
form HTML - <input type="range"> 태그 - 지정범위 내 입력값 지정 (= 인풋레인지타입/레인…
attribute HTML - multiple 속성 ★ - 복수 (파일업로드/이메일입력/옵션선택) 허용 (= multiple속…
attribute HTML - target 속성 ★ - (링크된 문서 열 곳 / 폼 제출할 곳) 지정 (= target속성 =…
attribute HTML - maxlength 속성 ★ - 입력 가능한 최대 글자 개수 지정 (= maxlength속성 = …
8/18
목록
찾아주셔서 감사합니다. Since 2012