최신 웹 개발 튜토리얼
 

HTML type Attribute


정의 및 사용

버튼의 요소의 type 속성은 버튼의 종류를 지정한다.

입력 요소의 경우, type 속성의 유형을 지정 <input> 표시 할 요소를.

메뉴의 요소의 type 속성은 메뉴의 종류를 지정한다.

삽입, 링크 오브젝트, 스크립트, 소스 및 스타일 요소를 들어, 그 유형 속성 (이전 MIME 타입이라고도 함) 인터넷 미디어 타입을 지정한다.


적용

type 속성은 다음과 같은 요소에 사용할 수 있습니다 :

집단 속성
<button> type
<embed> type
<input> type
<link> type
<menu> type
<object> type
<script> type
<source> type
<style> type

Button

하나의 역할을 두 버튼 요소 버튼 (형태) 하나의 리셋 버튼을 제출

<form action="demo_form.asp" method="get">
  First name: <input type="text" name="fname"><br>
  Last name: <input type="text" name="lname"><br>
  <button type="submit" value="Submit">Submit</button>
  <button type="reset" value="Reset">Reset</button>
</form>
»그것을 자신을 시도

Embed

지정된 용지 종류와 임베디드 플래시 애니메이션 :

<embed src="helloworld.swf" type="application/vnd.adobe.flash-movie">
»그것을 자신을 시도

Input

두 개의 서로 다른 입력 유형을 가진 HTML 양식; 텍스트 및 제출

<form action="demo_form.asp">
  Username: <input type="text" name="usrname"><br>
  <input type="submit" value="Submit">
</form>
»그것을 자신을 시도

Link

다음 예에서 type 속성은 링크 된 문서가 외부 스타일 시트 있음을 나타냅니다 :

<head>
<link rel="stylesheet" type="text/css" href="theme.css">
</head>
»그것을 자신을 시도

Menu

상황에 맞는 메뉴 :

<menu type="context" id="mymenu">
  <menuitem label="Refresh" onclick="window.location.reload();" icon="ico_reload.png">
  </menuitem>
  <menu label="Share on...">
    <menuitem label="Twitter" icon="ico_twitter.png"
    onclick="window.open('//twitter.com/intent/tweet?text='+window.location.href);">
    </menuitem>
    <menuitem label="Facebook" icon="ico_facebook.png"
    onclick="window.open('//facebook.com/sharer/sharer.php?u='+window.location.href);">
    </menuitem>
  </menu>
  <menuitem label="Email This Page"
  onclick="window.location='mailto:?body='+window.location.href;"></menuitem>
</menu>
»그것을 자신을 시도

Object

<object> 지정된 용지 종류와 요소 :

<object width="400" height="400" data="helloworld.swf" type="application/vnd.adobe.flash-movie"></object>
»그것을 자신을 시도

Script

와 스크립트 type 지정된 속성 :

<script type="text/javascript">
document.getElementById("demo").innerHTML = "Hello JavaScript!";
</script>
»그것을 자신을 시도

Source

의 사용 type 속성 :

<audio controls>
  <source src="horse.ogg" type="audio/ogg">
  <source src="horse.mp3" type="audio/mpeg">
Your browser does not support the audio element.
</audio>
»그것을 자신을 시도

Style

사용 type 의 미디어 유형을 지정하는 속성을 <style> 태그를 :

<style type="text/css">
h1 {color:red;}
p {color:blue;}

</style>
»그것을 자신을 시도

브라우저 지원

type 속성은 각 요소에 대한 다음과 같은 브라우저 지원을하고있다 :

요소
button
embed
input
link
menu 지원되지 않음 지원되지 않음 8.0
(단 = "컨텍스트"를 입력)
지원되지 않음 지원되지 않음
object
script
source 4.0 9.0 3.5 4.0 10.5
style