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

[attribute] HTML - autofocus 속성 - 포커스 자동 여부 지정 (= autofocus속성 = 오토포커스속성)

목차
  1. autofocus 예제 - <input> 경우
  2. autofocus 정의
  3. autofocus 구문
  4. autofocus 예제 - <button> 경우
  5. autofocus 예제 - <select> 경우
  6. autofocus 예제 - <textarea> 경우

 

autofocus 예제 - <input> 경우

 

<form action="/action_page.php">

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

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

  <label for="nick">별명:</label>

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

  <input type="submit">

</form>

 

 

autofocus 정의

 

페이지 로드 시, 해당 요소에 포커스 줄지 여부 지정하는 참거짓 속성.

 


 

1. autofocus 사용 가능 태그

<button>, <input>, <select>, <textarea>

 

2.

autofocus 속성 갖는 요소는 검고 굵은 테두리 갖음.

 

3.

IE10 이상 주요 최신 브라우저 모두 지원.

단, Firefox 브라우저는 <select> 태그 지원 X

 

 

autofocus 구문

 

  • <button type="button" autofocus>
  • <input autofocus>
  • <select autofocus>
  • <textarea autofocus>

 


[속성값]

 

없음.

 

 

autofocus 예제 - <button> 경우

 

<button type="button" autofocus onclick="alert('홈짱닷컴 Homzzang.com')">클릭</button>

 

 

autofocus 예제 - <select> 경우

 

<form action="/action_page.php">

  <label for="hz">좋아하는 언어:</label>

  <select name="hz" id="hz" autofocus>

    <option value="html">HTML</option>

    <option value="css">CSS</option>

    <option value="js">JS</option>

  </select>

  <br><br>

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

</form>

 

 

autofocus 예제 - <textarea> 경우

 

<textarea rows="3" cols="30" autofocus>

홈짱닷컴 Homzzang.com (홈페이지 제작관리 강의)

</textarea>

 

 


분류 제목
table HTML - <caption> 태그 - 테이블제목 (= 표제목 = caption태그 = 캡션태그) (HTML…
intro HTML - 준비물 + 추천링크 (※ 사용중지・사용폐기 태그) 2
basic HTML - <p> 태그 ★ - 글단락 (= 글문단 = p태그/p요소 = 피태그/피요소)
meta HTML - <meta> 태그 ★★ - 메타정보 (= meta태그 = 메타태그) (HTML5수정) + 모바일…
formatting HTML - <pre>, <xmp> 태그 ★ - 공백줄바꿈보존 (= 보존태그 = 있는그대로태그 = 있는대로태…
form HTML - <option> 태그 ★ - 선택사항 (= 옵션사항 = option태그 = 옵션태그)
style HTML - <span> 태그 ★★★ - 인라인요소그룹 (= span태그 = 스팬태그 = 스판태그)</spa…
font HTML - <sup> 태그 ★ - 위첨자 (= 상단작은글씨 = 상단태그 = sup태그 = 섭태그 = 서프태…
programming HTML - <script> 태그 ★★ - JS코드입력 (= 동적기능언어입력 = script태그 = 스크립트…
font HTML - <h1> ~ <h6> 태그 ★ - 문단제목글씨크기 (= 표제태그 = 단락제목글자크기 = h1태그…
style HTML - <div> 태그 ★★★★★ - 영역 지정 (= 섹션 분할 = div태그 = 디브태그 = 디비전태…
intro HTML - IE조건부주석 ★ (= 익스주석태그 = 익스플로러 조건문)
font HTML - <small> 태그 - 작은글씨 (= small태그 = 스몰태그)
font HTML - <font> 태그 - 폰트(크기/색깔/스타일) (= font태그 = 폰트태그, HTML5제외)
table HTML - <colgroup> 태그 - 테이블의 col태그묶음 (= colgroup태그 = 콜그룹태그, H…
font HTML - <em> 태그 - 의미 강조어 텍스트 기울게 표시 (= em태그 = 엠태그/이멤태그/엠퍼시스태그…
basic HTML - &nbsp; 기호 - 줄바꿈 않는 공백/빈칸 표시 특수문자 (= 공백기호/빈칸기호 = Non-B… 1
form HTML - <legend> 태그 - fieldset제목/설명 (= legend태그 = 레전드태그) (HTM…
formatting HTML - <code> 태그 - 컴퓨터소스코드 출력 (= code태그 = 코드태그)
basic HTML - <br> 태그 ★ - 줄바꿈 (=br태그/br요소 = 비알태그/비알요소) ※ 한줄아래로 줄바꿈 …
16/18
목록
찾아주셔서 감사합니다. Since 2012