- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
How to use the html button tag
ஃ What is the <button> tag in HTML?
ஃ Syntax of HTML <dialog> tag
ஃ Why USe the <button> tag ?
ஃ Important Attributes <button>
ஃ Type of <button> tag in HTML
ஃ how to use the html button tag Example
ஃ Explain Program
ஃ how to use the html button tag Output
What is the <button> tag in HTML?
✅The <buttons> tag are one of the most important elements on website.
✅HTML <button> tag used create clickable buttons than perform actions such as submitting forms.
✅ HTML <button> tag is use to create a clickable button that can submit forms, reset data or trigger actions.
Syntax of HTML <dialog> tag
<button type="button"> Button text </button>
<button type="button"> Button text </button>
Why USe the <button> tag ?
✔ Creates interactive elements.
✔ Is accessible by keyboard and screen readers.
✔ Works with forms and Javascript.
✔ Can contain text, icons and HTML.
Type of <button> tag in HTML
1) Submit Button (type= "submit ")
- submit form data to server.
- button acts submit button by default.
<form>
<button type="submit">Submit</button>
</form>
2) Reset Button (type= "reset")
- Resets all form fields to default values .
- reset buttons carefully as they can erase user input.
<form>
<input type="text" value="hi everyone">
<button type="reset">Reset</button>
</form>
3) Normal Button (type="button")
- perform custom actions usually with javascript
<form>
<button type="button"
onclick="alert(button clicked")>Click ME
</button>
</form>
Important Attributes <button>
1) type
<form>
<button type="submit"></button>
</form>
2) disabled
- Disables the button.
<form>
<button disabled>Disabled</button>
</form>
3) name and value
- use to send button data during form submission
<form>
<button name="action" value ="login">
login</button>
</form>
4) autofocus
- automatically focuses the button when page loads.
<form>
<button autofocus>Click</button>
</form>
how to use the html button tag
Example
<!DOCTYPE html>
<html>
<head>
<title> HTML Button tag </title>
</head>
<body>
<h1>HTML Button Tag </h1>
<button type="button">Click Me</button>
</body>
</html>
how to use the html button tag
Explain Program
Step 1]
<!DOCTYPE html>
- This declare the document type.
- browser that the document is written in html
Step 2 ]
<html>.... . </html>
- html is the root element of the html page.
- Every thing inside it is part of the webpage.
Step 3]
<head>
<title> HTML Button tag </title>
</head>
- <head> section
- head section contains metadata about page. not visible on the page itself.
- <title> tag title section set the title of the page shows the browser tab.
Step 4]
<body>
<h1>HTML Button Tag </h1>
<button type="button">Click Me</button>
</body>
- HTML <body> tag contains all appear on webpage.
- HTML <h1> tag heading tag.
- HTML <button> :- create button on webpage.
- <type=" button"> :- browser this clickable button
- </button> :- ends the button.
Step 6]
Closing tag
</body>
</html>
how to use the html button tag
Output
Related Post :-
how to set image height
html link tag explain
how to use pre tag
Comments
Post a Comment