HTML Button Tag allows creating an active button control on a web page using the HTML document. This
Buttons were created using
Syntax:
Like other HTML tags, even button tags have both opening and closing tags, and the button type is defined using attributes.
<button> // some stuff like content / image </button>
Attributes of HTML Button Tag
No Special attributes have been used as they don’t have any required attributes; instead, they are used as an ordinary button with the type=” attribute. “Even this element is styled using CSS, with the properties to alter the changes in the button tag. Those properties are CSS font family, Font-weight, Text-decoration, and font-Style. Coloring properties like Background-color and layout properties like text-overflow and text-indent.
S.no | Attribute Name | Description | Example |
1 | autofocus | It is considered a Boolean attribute. | |
2 | disabled | Making a button non-clickable. | |
3 | Form | It Creates a form | |
4 | formaction | It specifies the current location for submitting the form data. | |
5 | formnovalidate | It appears in gray and gives non-validation features. | |
6 | Formmethod | It specifies the methods while referring to the next web page(get the post of HTTP methods) | |
7 | formtarget | It specifies the target path for the server response when a form action is done. | |
8 | formenctype | It has been used when a form is submitted to the webserver for the response; it activates the type of content used. | |
8 | name | It specifies the button name used in the form element, which is used by form inputs. | |
9 | type | It specifies the type of button being used. It has three default values submit, reset, and text. | |
10 | value | It gives an initial value when a button is used along with the form data | |
11 | tabindex | It specifies the tab key and the order does the preference. | |
12 | onclick | When a button is pressed, it runs a small javascript code behind it. |
Examples to Implement in HTML Button Tag
Below are examples of implementing an HTML Button Tag:
Example #1
Code:
<title> HTML button tag Example</title> <h2 id="HTML-button-tag-Example">HTML button tag Example </h2>
Output:
Example #2
Code:
<h3> <center> Example using CSS </center> <h3> Normal Class <button type="button">Add to the First class</button> <hr> Economic Class <button type="button" style="color: pink;"><b> Book Economic Class </b></button> <hr> Bussiness class <button type="button" style="color: orange;"><b> Book Bussiness Class </b></button> <hr> Departure <button type="button" style="font: bold 12px Open Sans;">Norway </button><br> </h3> </h3>
Output:
Example #3
With CSS: Here, we have used padding and margin property. Here are some ways to look at the page better. To create a button with rounded corners, use border-radius.
Code:
<style> body { color: #000; height: 90vh; background: linear-gradient(-90deg, #a1c3d1 0%, #c48b9e 100%) no-repeat; text-align: center; } input { width: 280px; display: block; margin: 2rem auto; border: 3px solid #fbc7ff; padding: 7px; background: transparent; border-radius: 25px; outline: none; } ::placeholder { color: #00ced1; } .btn { background:#96f905; border: none; height: 3rem; border-radius: 20px; width: 220px; display: block; color: #96f905; outline: none; margin: 2rem auto; } </style> <h1 id="HTML-Form-action-Using-Button">HTML Form action Using Button</h1>
Output:
Example #4
The below example shows how to use the attribute autofocus with button element; in an example, when a page Loads, it focuses on the first HTML control.
Code:
<title> Button Demo <button>autofocus Attribute </button> </title> <h1 style="color: blue;"> EDUCBA Web Tutorial </h1> <h2> Button Tag <button>autofocus Attribute </button> </h2> <h2> Button Tag <button>autofocus Attribute </button> </h2> <button id="GFG" autofocus> Press </button> <br>
Output:
Example #5
onclick attribute demo. In the below example, I have used JavaScript to take action in the button; meanwhile, it alerts a dialog box with a text message. We use a JavaScript function to make the critical decision by activating the button with onclick().
Code:
<title>HTML On Click Button Demo</title> <h3 id="HTML-On-Click-Button-Demo"> HTML On Click Button Demo</h3> <button onclick="alert('Hi Welcome to EDUCBA!')"> Press me... </button>
Output: Before the button press
Alert Message – After the Button click
Example #6
Code:
<script type="text/javascript" src="scripts.js"> </script> <link rel="stylesheet" href="styles.css"> <script type="text/javascript" src="scripts.js"></script> <link rel="stylesheet" href="styles.css"> <p>The button loads to the next web page!</p> <a href="https://www.educba.com" target="_blank"> <button>Submit!</button> </a>
Output:
Conclusion
In summary, we have learned about the HTML Button tag. This tag initiates an action and submits content within an HTML document. Important aspects of the website create an easy button, CSS, and JavaScript to look colorful. You can also learn many options related to buttons.
Das obige ist der detaillierte Inhalt vonHTML-Button-Tag. Für weitere Informationen folgen Sie bitte anderen verwandten Artikeln auf der PHP chinesischen Website!

HtmlattributesarecrucialinwebdevelopmentforcontrollingBehavior, Aussehen und Funktionalität

Das ALT -Attribut ist ein wichtiger Bestandteil des Tags in HTML und wird verwendet, um alternative Text für Bilder bereitzustellen. 1. Wenn das Bild nicht geladen werden kann, wird der Text im ALT -Attribut angezeigt, um die Benutzererfahrung zu verbessern. 2. Bildschirmleser verwenden das ALT -Attribut, um sehbehinderte Benutzer zu helfen, den Inhalt des Bildes zu verstehen. 3. Search Engines Index Text im ALT -Attribut zur Verbesserung des SEO -Rankings von Webseiten.

Die Rollen von HTML, CSS und JavaScript in der Webentwicklung sind: 1. HTML wird zum Erstellen von Webseitenstruktur verwendet. 2. CSS wird verwendet, um das Erscheinungsbild von Webseiten zu verschönern. 3.. JavaScript wird verwendet, um eine dynamische Interaktion zu erreichen. Durch Tags, Stile und Skripte erstellen diese drei zusammen die Kernfunktionen moderner Webseiten.

Das Einstellen der Lang -Attribute eines Tags ist ein wichtiger Schritt zur Optimierung der Web -Barrierefreiheit und der SEO. 1) Stellen Sie das Lang -Attribut im Tag ein, z. B.. 2) Setzen Sie in mehrsprachigen Inhalten Lang -Attribute für verschiedene Sprachteile, wie z. 3) Verwenden Sie Sprachcodes, die den ISO639-1-Standards entsprechen, wie z. B. "EN", "FR", "ZH" usw. Das korrekte Einstellen des Lang-Attributs kann die Zugänglichkeit von Webseiten und Suchmaschinenrankings verbessern.

HtmlattributesareessentialforenHancingWebelements'Functionality und Interaktion

Tocreatealistinhtml, usefornorderedListsandfororderedLists: 1) ForunorderedLists, WrapitemsinanduseforeachItem, RenderingasabulletedList.2) ForderedLists, UseinDFornumnedLists, anpassbar mit

HTML wird verwendet, um Websites mit klarer Struktur zu erstellen. 1) Verwenden Sie Tags wie und definieren Sie die Website -Struktur. 2) Beispiele zeigen die Struktur von Blogs und E-Commerce-Websites. 3) Vermeiden Sie häufige Fehler wie eine falsche Verschachtelung des Etiketts. 4) Optimieren Sie die Leistung, indem Sie HTTP -Anforderungen reduzieren und semantische Tags verwenden.

ToInsertanimageIntoanhtmlPage, UsethetagwithSrcandalTatTributes.1) UsealtTextForAccessibilityandseo.2) ImplementsRCSetForeResiveIms.3) apparaLLaLaLaDingWithading = "Lazy" tooPiMizePerformance


Heiße KI -Werkzeuge

Undresser.AI Undress
KI-gestützte App zum Erstellen realistischer Aktfotos

AI Clothes Remover
Online-KI-Tool zum Entfernen von Kleidung aus Fotos.

Undress AI Tool
Ausziehbilder kostenlos

Clothoff.io
KI-Kleiderentferner

Video Face Swap
Tauschen Sie Gesichter in jedem Video mühelos mit unserem völlig kostenlosen KI-Gesichtstausch-Tool aus!

Heißer Artikel

Heiße Werkzeuge

Senden Sie Studio 13.0.1
Leistungsstarke integrierte PHP-Entwicklungsumgebung

MinGW – Minimalistisches GNU für Windows
Dieses Projekt wird derzeit auf osdn.net/projects/mingw migriert. Sie können uns dort weiterhin folgen. MinGW: Eine native Windows-Portierung der GNU Compiler Collection (GCC), frei verteilbare Importbibliotheken und Header-Dateien zum Erstellen nativer Windows-Anwendungen, einschließlich Erweiterungen der MSVC-Laufzeit zur Unterstützung der C99-Funktionalität. Die gesamte MinGW-Software kann auf 64-Bit-Windows-Plattformen ausgeführt werden.

Notepad++7.3.1
Einfach zu bedienender und kostenloser Code-Editor

mPDF
mPDF ist eine PHP-Bibliothek, die PDF-Dateien aus UTF-8-codiertem HTML generieren kann. Der ursprüngliche Autor, Ian Back, hat mPDF geschrieben, um PDF-Dateien „on the fly“ von seiner Website auszugeben und verschiedene Sprachen zu verarbeiten. Es ist langsamer und erzeugt bei der Verwendung von Unicode-Schriftarten größere Dateien als Originalskripte wie HTML2FPDF, unterstützt aber CSS-Stile usw. und verfügt über viele Verbesserungen. Unterstützt fast alle Sprachen, einschließlich RTL (Arabisch und Hebräisch) und CJK (Chinesisch, Japanisch und Koreanisch). Unterstützt verschachtelte Elemente auf Blockebene (wie P, DIV),

Herunterladen der Mac-Version des Atom-Editors
Der beliebteste Open-Source-Editor
