Home Web Front-end HTML Tutorial The difference between BUTTON tag and INPUT tag

The difference between BUTTON tag and INPUT tag

Jun 27, 2017 am 11:33 AM
button input the difference

Summary of the theme in one sentence: <button> has the same effect as <input type="button" ... > but is more powerful in terms of controllability.

The Forms part of the HTML 4.01 specification has the following control types: buttons, checkboxes, radio buttons, menus, text input, file select, hidden controls, object controls. Except for buttons/menus/object controls, all are completed by <input>.

What I’m talking about here is <button> and <input>.

<button> and <input>
As specified in the specification: <button> and <input> can be used to make form buttons. Please refer to the detailed definitions of these elements for different button types. It should be noted that <button> supports richer presentation functions than <input>.

Some differences
Everyone knows that <input> can be used like this (in fact, it must be used like this): <input type="submit" value="OK" />, must be closed like this. Instead of: <input type="submit" value="OK" ></input>. Because the opening tag is required, but the closing tag is prohibited.

<button> is more powerful than <input> in that it can contain content. Its value is not written in the value attribute, but is included in the tag. For example: <button>OK</button>. The opening tag and closing tag of <button> are required. This way you will get something like formalized dominance.

You can write like this:<button><strong>OK</strong>, I do.</button>, or even insert image:<button><img src="button.gif" alt="" />, it's great.</button>. Somewhat similar to <input type="image">, but it is obviously much more powerful.

The last thing to note is that images included in <button> cannot use hotspotsmap, that is, they cannot<img src="foo.gif" usemap="..." />, this is illegal. Of course, it can no longer contain items such as input, select, textarea, label, button, form, fieldset, iframe, and isindex (deprecated) elements.


Not original, sourced from the Internet.

Summary of the theme in one sentence: <button> has the same effect as <input type="button" ... > but is more powerful in terms of controllability.

The Forms part of the HTML 4.01 specification has the following control types: buttons, checkboxes, radio buttons, menus, text input, file select, hidden controls, object controls. Except for buttons/menus/object controls, all are completed by <input>.

What I’m talking about here is <button> and <input>.

<button> and <input>
As specified in the specification: <button> and <input> can be used to make form buttons. Please refer to the detailed definitions of these elements for different button types. It should be noted that <button> supports richer presentation functions than <input>.

Some differences
Everyone knows that <input> can be used like this (in fact, it must be used like this): <input type="submit" value="OK" />, must be closed like this. Instead of: <input type="submit" value="OK" ></input>. Because the opening tag is required, but the closing tag is prohibited.

<button> is more powerful than <input> in that it can contain content. Its value is not written in the value attribute, but included in the tag. For example: <button>OK</button>. The opening tag and closing tag of <button> are required. This way you will get something like formalized dominance.

You can write like this:<button><strong>OK</strong>, I do.</button>, or even insert an image: <button><img src="button.gif" alt="" />, it's great.</button>. Somewhat similar to <input type="image">, but it is obviously much more powerful.

The last thing to note is that images included by <button> cannot use hotspot maps, that is, they cannot use <img src="foo.gif" usemap="..." />, this is illegal. Of course, it can no longer contain items such as input, select, textarea, label, button, form, fieldset, iframe, and isindex (deprecated) elements.


Not original, sourced from the Internet.

The above is the detailed content of The difference between BUTTON tag and INPUT tag. For more information, please follow other related articles on the PHP Chinese website!

Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn

Hot Article Tags

Notepad++7.3.1

Notepad++7.3.1

Easy-to-use and free code editor

SublimeText3 Chinese version

SublimeText3 Chinese version

Chinese version, very easy to use

Zend Studio 13.0.1

Zend Studio 13.0.1

Powerful PHP integrated development environment

Dreamweaver CS6

Dreamweaver CS6

Visual web development tools

SublimeText3 Mac version

SublimeText3 Mac version

God-level code editing software (SublimeText3)

deepseek What is the difference between r1 and v3 version deepseek What is the difference between r1 and v3 version Feb 19, 2025 pm 03:24 PM

deepseek What is the difference between r1 and v3 version

Does Bitcoin have stocks? Does Bitcoin have equity? Does Bitcoin have stocks? Does Bitcoin have equity? Mar 03, 2025 pm 06:42 PM

Does Bitcoin have stocks? Does Bitcoin have equity?

Summary of FAQs for DeepSeek usage Summary of FAQs for DeepSeek usage Feb 19, 2025 pm 03:45 PM

Summary of FAQs for DeepSeek usage

What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading Mar 03, 2025 pm 11:54 PM

What is the difference between pre-market and after-market trading? Detailed explanation of the differences between pre-market and after-market trading

Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Why is Bittensor said to be the 'bitcoin' in the AI ​​track? Mar 04, 2025 pm 04:06 PM

Why is Bittensor said to be the 'bitcoin' in the AI ​​track?

Is there any difference between South Korean Bitcoin and domestic Bitcoin? Is there any difference between South Korean Bitcoin and domestic Bitcoin? Mar 05, 2025 pm 06:51 PM

Is there any difference between South Korean Bitcoin and domestic Bitcoin?

Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025? Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025? Mar 03, 2025 pm 07:09 PM

Pepe bought and sold out in a big way, is MUTM a smarter investment in 2025?

Vertical proxy: Application scenarios and interpretation of disruptive potential of encryption native proxy Vertical proxy: Application scenarios and interpretation of disruptive potential of encryption native proxy Mar 04, 2025 am 10:21 AM

Vertical proxy: Application scenarios and interpretation of disruptive potential of encryption native proxy

See all articles