Skip to content
View in the app

A better way to browse. Learn more.

OKCCN - XenForo & IPS Plugin Marketplace

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.
  • Language

Featured Replies

  • Administrators

HTML Buttons


Buttons let users interact with a web page. They can submit forms, run JavaScript, or trigger different actions when clicked.


HTML Button

The HTML <button> element defines a clickable button.

By itself, the button does nothing until you add an action to it.

Example

<button>Click Me</button>

Styling HTML Buttons

Buttons are often styled with CSS:

Example

<button class="mytestbtn">Green Button</button>

Disabled Buttons

Use the disabled attribute to make a button unclickable:

Example

<button disabled>Disabled Button</button>

Tip: Disabled buttons cannot be clicked and usually appear faded.




Button with JavaScript

You can run JavaScript when the user clicks a button using the onclick attribute:

Example

<button>Click Me</button>

Note: You will learn more about JavaScript in our HTML JavaScript chapter.


Button Types

The type attribute defines what a button does when clicked. There are three button types:

  • type="button" - A normal clickable button (does nothing by default)
  • type="submit" - Submits a form
  • type="reset" - Resets all form fields
<button type="button">Normal Button</button>
<button type="submit">Submit</button>
<button type="reset">Reset</button>

Buttons are often used inside forms, which you will learn more about in a later chapter.

For now, just know that a submit button sends the form data to the server, while a reset button clears the form:

Example

<form action="/action_page.php">
  First name: <input type="text" name="fname">
  <button type="submit">Submit</button>
  <button type="reset">Reset Form</button>
</form>

Note: You should always specify the type attribute. Inside a form, the default type is submit, and browsers may behave differently if the type is omitted.


HTML Button Reference

Tag Description
<button> Defines a clickable button

Tip: For a complete list of all HTML tags, visit our HTML Tag Reference.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

Account

Navigation

Search

Search

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.