이 번역은 완료되지 않았습니다. 이 문서를 번역해 주세요.

HTML <button> 요소는 클릭할수 있는 버튼을 나타냅니다.

 

속성

이 요소는 전역 속성을 포함합니다.

autofocus HTML5
This Boolean attribute lets you specify that the button should have input focus when the page loads, unless the user overrides it, for example by typing in a different control. Only one form-associated element in a document can have this attribute specified.
autocomplete
The use of this attribute on a <button> is nonstandard and Firefox-specific. By default, unlike other browsers, Firefox persists the dynamic disabled state of a <button> across page loads. Setting the value of this attribute to off (i.e. autocomplete="off") disables this feature. See bug 654072.
disabled

This Boolean attribute indicates that the user cannot interact with the button. If this attribute is not specified, the button inherits its setting from the containing element, for example <fieldset>; if there is no containing element with the disabled attribute set, then the button is enabled.

Firefox will, unlike other browsers, by default, persist the dynamic disabled state of a <button> across page loads. Use the autocomplete attribute to control this feature.

form HTML5
The form element that the button is associated with (its form owner). The value of the attribute must be the id attribute of a <form> element in the same document. If this attribute is not specified, the <button> element must be a descendant of a form element. This attribute enables you to place <button> elements anywhere within a document, not just as descendants of their <form> elements.
formaction HTML5
The URI of a program that processes the information submitted by the button. If specified, it overrides the action attribute of the button's form owner.
formenctype HTML5
If the button is a submit button, this attribute specifies the type of content that is used to submit the form to the server. Possible values are:
  • application/x-www-form-urlencoded: The default value if the attribute is not specified.
  • multipart/form-data: Use this value if you are using an <input> element with the type attribute set to file.
  • text/plain

If this attribute is specified, it overrides the enctype attribute of the button's form owner.

formmethod HTML5
If the button is a submit button, this attribute specifies the HTTP method that the browser uses to submit the form. Possible values are:
  • post: The data from the form is included in the body of the form and is sent to the server.
  • get: The data from the form are appended to the form attribute URI, with a '?' as a separator, and the resulting URI is sent to the server. Use this method when the form has no side-effects and contains only ASCII characters.

If specified, this attribute overrides the method attribute of the button's form owner.

formnovalidate HTML5
If the button is a submit button, this Boolean attribute specifies that the form is not to be validated when it is submitted. If this attribute is specified, it overrides the novalidate attribute of the button's form owner.
formtarget HTML5
If the button is a submit button, this attribute is a name or keyword indicating where to display the response that is received after submitting the form. This is a name of, or keyword for, a browsing context (for example, tab, window, or inline frame). If this attribute is specified, it overrides the target attribute of the button's form owner. The following keywords have special meanings:
  • _self: Load the response into the same browsing context as the current one. This value is the default if the attribute is not specified.
  • _blank: Load the response into a new unnamed browsing context.
  • _parent: Load the response into the parent browsing context of the current one. If there is no parent, this option behaves the same way as _self.
  • _top: Load the response into the top-level browsing context (that is, the browsing context that is an ancestor of the current one, and has no parent). If there is no parent, this option behaves the same way as _self.
name
폼 데이터와 함께 전송되는 버튼의 이름입니다.
type
버튼의 타입입니다. 아래와 같은 값이 올 수 있습니다.:
  • submit:  이 버튼은 폼 데이터를 서버로 전송합니다.  만약에  속성을 지정하지 않았다면  이 값이 디폴트 값이고 다른 속성 값을 지정하였다면 빈 값에 동적으로 적용됩니다. 
  • reset: 이 버튼은 모든 제어되고 있는 값을 초기 값으로 리셋합니다.
  • button: 이 버튼에는 디폴트로 지정된 행위가 없습니다. 이는 이벤트를 실행시켰을때 발생되는 엘리먼트 이벤트와 연관되어있는 클라이언트 사이트 스크립트를 가질 수 있습니다. 
value
버튼의 초기값 입니다.

예제

<button name="button">Click me</button>
 

Please note that this button has CSS applied.

사양

사양 상태 주석
HTML Living Standard
The definition of '<button>' in that specification.
Living Standard  
HTML5
The definition of '<button>' in that specification.
Recommendation  
HTML 4.01 Specification
The definition of '<button>' in that specification.
Recommendation  

브라우저 호환성

FeatureChromeEdgeFirefoxInternet ExplorerOperaSafari
Basic support Yes Yes Yes Yes Yes Yes
autofocus5 Yes4109.65
autocomplete No No Yes No No No
disabled Yes Yes Yes Yes Yes Yes
form Yes16 Yes No Yes Yes
formaction9 Yes410 ? ?
formenctype9 Yes41010.6 ?
formmethod9 Yes410 ? ?
formnovalidate Yes Yes Yes Yes Yes Yes
formtarget Yes Yes Yes Yes Yes Yes
name Yes Yes Yes Yes Yes Yes
type Yes Yes Yes Yes Yes Yes
value Yes Yes Yes Yes Yes Yes
FeatureAndroid webviewChrome for AndroidEdge mobileFirefox for AndroidOpera AndroidiOS SafariSamsung Internet
Basic support Yes Yes Yes Yes Yes Yes Yes
autofocus ? ? ?4 ? ? ?
autocomplete No No No Yes No No No
disabled Yes Yes Yes Yes Yes Yes Yes
form Yes Yes Yes Yes Yes Yes Yes
formaction ? ? Yes4 ? ? ?
formenctype ? ? Yes4 ? ? ?
formmethod ? ? Yes4 ? ? ?
formnovalidate Yes Yes Yes Yes Yes Yes Yes
formtarget Yes Yes Yes Yes Yes Yes Yes
name Yes Yes Yes Yes Yes Yes Yes
type Yes Yes Yes Yes Yes Yes Yes
value Yes Yes Yes Yes Yes Yes Yes

 

Accessibility concerns

 

 

Clicking and focus

Whether clicking on a <button> causes it to (by default) become focused varies by browser and OS. The results for <input> of type="button" and type="submit" were the same.

Does clicking on a <button> give it the focus?
Desktop Browsers Windows 8.1 OS X 10.9
Firefox 30.0 Yes No (even with a tabindex)
Chrome 35 Yes Yes
Safari 7.0.5 N/A No (even with a tabindex)
Internet Explorer 11 Yes N/A
Presto (Opera 12) Yes Yes
Does tapping on a <button> give it the focus?
Mobile Browsers iOS 7.1.2 Android 4.4.4
Safari Mobile No (even with a tabindex) N/A
Chrome 35 ??? Yes

참고

<button> elements are much easier to style than <input> elements. You can add inner HTML content (think <em>, <strong> or even <img>), and make use of :after and :before pseudo-element to achieve complex rendering while <input> only accepts a text value attribute.

IE7 has a bug where when submitting a form with <button type="submit" name="myButton" value="foo">Click me</button>, the POST data sent will result in myButton=Click me instead of myButton=foo.
IE6 has an even worse bug where submitting a form through a button will submit ALL buttons of the form, with the same bug as IE7.
This bug has been fixed in IE8.

Firefox will add, for accessibility purposes, a small dotted border on a focused button. This border is declared through CSS, in the browser stylesheet, but you can override it if necessary to add your own focused style using button::-moz-focus-inner { }

Firefox will, unlike other browsers, by default, persist the dynamic disabled state of a <button> across page loads. Setting the value of the autocomplete attribute to off disables this feature. See bug 654072.

Firefox <35 for Android sets a default background-image gradient on all buttons (see bug 763671). This can be disabled using background-image: none.

같이 보기

폼을 생성하는데 사용되는 다른 요소들: <form>, <datalist>, <fieldset>, <input>,<keygen>, <label>, <legend>, <meter>, <optgroup>, <option>, <output>, <progress>, <select>, <textarea>.

문서 태그 및 공헌자

이 페이지의 공헌자: urty5656, sooyoung32, azunyan3, moolow
최종 변경자: urty5656,