Example
The following code marks a button:
<button type="button">Click Me!</button>
Browser support
IE
Firefox
Chrome
Safari
Opera
All major browsers support the
Important: If you use the button element in an HTML form, different browsers will submit different values. Internet Explorer will submit the text between
Definition and usage
Inside the button element, you can place content, such as text or images. This is the difference between this element and buttons created using input elements.
The only prohibited element is the image map, as its mouse and keyboard-sensitive actions interfere with the behavior of the form buttons.
Always specify the type attribute for buttons. The default type in Internet Explorer is "button", while the default in other browsers (including the W3C specification) is "submit".
Differences between HTML 4.01 and HTML 5
New attributes in HTML 5: autofocus, form, formaction, formenctype, formmethod, formnovalidate and formtarget.
Tips and Notes
Note: If you use the button element in an HTML form, different browsers will submit different button values. Please use the input element to create buttons in HTML forms.
Attribute
new: New attribute in HTML5.
<button onclick="tz()">跳转</button> <script> function tz(){ window.location.href='目标网址'; } </script>
a is a hyperlink type="button" and it is obviously wrong to write it in a
It should be written like this:
html elements can use style sheets to change the size and background
The above is the detailed content of Introduction and example analysis of html