<button>
Bedeutung
Schaltfläche in einem Formular
Notation
<button [Attribute]>[Elementinhalt]</button>
Elternelemente
Kann gemäß der HTML5 Spezifikation innerhalb der folgenden Elemente vorkommen:
Liste der HTML 5 Block-ElementeBlock-Elemente
und Liste der HTML 5 Inline-ElementeInline-Elemente
- ausgenommen zum <button> Element<button>
.
Elementinhalt
Kann Text mit folgenden anderen HTML-Elementen enthalten:
zum <abbr> Element<abbr>
, zum <address> Element<address>
, zum <b> Element<b>
, zum <bdo> Element<bdo>
, zum <blockquote> Element<blockquote>
, zum <br> Element<br>
, zum <cite> Element<cite>
, zum <code> Element<code>
, zum <dfn> Element<dfn>
, zum <div> Element<div>
, zum <dl> Element<dl>
, zum <em> Element<em>
, zum <hr> Element<hr>
, zum <i> Element<i>
, zum <img> Element<img>
, zum <kbd> Element<kbd>
, zum <map> Element<map>
, zum <menu> Element<menu>
, zum <noscript> Element<noscript>
, zum <object> Element<object>
, zum <ol> Element<ol>
, zum <p> Element<p>
, zum <pre> Element<pre>
, zum <q> Element<q>
, zum <samp> Element<samp>
, zum <script> Element<script>
, zum <small> Element<small>
, zum <span> Element<span>
, zum <strong> Element<strong>
, zum <sub> Element<sub>
, zum <sup> Element<sup>
, zum <table> Element<table>
, zum <ul> Element<ul>
und zum <var> Element<var>
.
Attribute
Kann folgende elementspezifische Attribute enthalten:zum HTML5 Attribut autofocusautofocus
| zum HTML5 Attribut disableddisabled
| zum HTML5 Attribut formform
| zum HTML5 Attribut formactionformaction
| zum HTML5 Attribut formenctypeformenctype
| zum HTML5 Attribut formmethodformmethod
| zum HTML5 Attribut formnovalidateformnovalidate
| zum HTML5 Attribut formtargetformtarget
| zum HTML5 Attribut namename
| zum HTML5 Attribut typetype
| zum HTML5 Attribut valuevalue
Des Weiteren kann das Element folgende allgemeinen Attribute und Event-Handler enthalten:zum HTML5 Attribut accesskeyaccesskey
| zum HTML5 Attribut classclass
| zum HTML5 Attribut contenteditablecontenteditable
| zum HTML5 Attribut contextmenucontextmenu
| zum HTML5 Attribut datadata
| zum HTML5 Attribut dirdir
| zum HTML5 Attribut draggabledraggable
| zum HTML5 Attribut hiddenhidden
| zum HTML5 Attribut idid
| zum HTML5 Attribut itemitem
| zum HTML5 Attribut itempropitemprop
| zum HTML5 Attribut langlang
| zum HTML5 Attribut spellcheckspellcheck
| zum HTML5 Attribut stylestyle
| zum HTML5 Attribut subjectsubject
| zum HTML5 Attribut tabindextabindex
| zum HTML5 Attribut titletitle
onabort
| onblur
| onchange
| onclick
| oncontextmenu
| ondblclick
| ondrag
| ondragend
| ondragenter
| ondragleave
| ondragover
| ondragstart
| ondrop
| onfocus
| onformchange
| onforminput
| oninput
| onkeydown
| onkeypress
| onkeyup
| onmousedown
| onmousemove
| onmouseout
| onmouseover
| onmouseup
| onmousewheel
| onscroll
| onselect
| onsubmit
Standard-Style-Formateigenschaften
button {
display: inline-block
}
Beispiel
<button name="Bezeichnung" type="button" value="Formular-Wert" onclick="alert('Ein Button!');">Schaltflächen-Text</button><button name="Bezeichnung" type="button" value="Formular-Wert" onclick="alert('Ein Image Button!');"><img src="http://static.html5-webdesign.de/img/icons/pin.png" alt="Alternativtext" width="21" height="21" /></button>
Anzeigebeispiel
Erläuterung
Das <button>
Element definiert eine Schaltfläche und kann im Gegensatz zu anderen Formularelementen auch ausserhalb des <form>
Tag notiert werden. Im Elementinhalt zwischen <button>[...]</button>
können neben Text auch <img>
Elemente notiert werden.