How do you add buttons in HTML ?

  • In HTML <button> tag is used to clickable button within form on your webpage.
  • We can put content like image or text within the <button>to</button> tag.
  • For <button> tag we should always specify the type attribute.
  • The button element is used for various browsers using different default type.
  • Button tag can be used inside and outside the form in HTML.
  • It works as the submit button and also reset button, while if we use it inside the form.
  • It can call JS on it, while if weuse it outside the form.

Sample Code

<!DOCTYPE html>
<html>
<body>

<h1>Welcome to Wikitechy</h1>

<button type="button" onclick="alert('Hello world!')">Click Me!</button>

</body>
</html>

Output

Leave a Reply

Your email address will not be published. Required fields are marked *

You May Also Like

What is a marquee tag ?

In HTML it is used to create scrolling text or image in a webpage. It scrolls either from vertically top to bottom or bottom to top or horizontally left to…
View Answer

How to Align Text in HTML ?

By using markup language, HTML is used to design webpages. It defines the link between the webpages. It defines the structure of webpages where markup language is used to define…
View Answer