Learn HTML
Lesson 1 - Overview Of The Web And HTML
Lesson 3 - Images And Multimedia
Lesson 4 - Writing Your First HTML Page
Lesson 5 - Overview Of CSS
Lesson 6 - CSS Selectors And Properties
Lesson 7 - Applying CSS To HTML
Lesson 8 - Box Model
Lesson 9 - Positioning And Layout
Lesson 10 - Flexbox
Buttons in HTML allow you to create interactive elements that users can click on. The <button>
tag is used to define a button.
<button>Click Me!</button>
In the example above, <button>
creates a clickable button labeled "Click Me!".
<button onclick="alert('You clicked the button!')">Click Me!</button>
In the interactive example, <button>
also creates a clickable button labeled "Click Me!". When clicked, it triggers an alert
dialog that says "You clicked the button!".
Attributes such as type
, name
, and value
can be added to <button>
tags for different functionalities:
type
: Specifies the type of button (submit
, reset
, or button
).name
: Provides a name for the button, useful when submitting form data.value
: Assigns a value associated with the button.Buttons can be styled using CSS to enhance their appearance and usability on webpages.