What is the difference between <button> and <input type=“button” />
Place to talk about website HTM elements, CSS style and design, and get help with HTML, CSS codes.
-
Marius
- Posts:107
What is the difference between <button> and <input type=“button” />
Hi
Which is better to use:
Or:
What are the main differences between the two, if any?
Are there valid reasons to use one instead of the other?
Are there valid reasons to use combine them?
Does using <button> come with compatibility issues, seeing it is not very widely used?
Admin
Posts:805
Hi
From what i found on the internet.
You can put html into a <BUTTON> tag, for example an image, or other tags, and it is much easier to style using CSS. Buttons can also contain ::before and ::after pseudo-elements.
IE 6 has problems when including multiple <button> into a <form>.
- If you just want a button with a simple text into a form, better use: "<input type="button" />", because <button> will implicitly submit, which can cause problems if you want to use a button in a form without it submitting.
- If you want buttons that aren't into a <form>, for example to be accessed in javascript, use <button>.
Similar Topics
- Redirect according to browser type
JavaScript - jQuery - Ajax
First post
Pleasant Coursesweb,
I have two `simple` javascript what I wanna combine between detecting in two different browsers to script to another page....
Last post
Marplo thanks for quick feedback took me more hours, I should have come earlier with asking questions.
It is a waste I`m not have experiance with...