How do I set the style of the HTML button label? An introduction to the style of the HTML button label

Source: Internet
Author: User
This article mainly introduces the styling of the HTML button tag, as well as the beautification style of the HTML button tag, let's read this article together.

Let's first introduce the style settings for the button tag in HTML:

Normal button settings:

You can create a normal button by setting the Type property of the INPUT element to "button". The text displayed on the button is the value of the Value property, and if the Value property is not provided, only an empty button is created. Such as:

<input type= "button" value= "Buy Now" >

The effect is obvious, which is the default normal button setting.

By default, clicking on the normal button does not react. Therefore, you need to register the event for the normal button and write the appropriate handler function manually. If you want to submit the form when you click the button above, register the onclick event for the button. Such as:

<form name= "buy" action= "form.html" method= "POST" >    <button onclick= "submitForm (Buy)" > Buy Now </ Button></form>

Clicking the button now triggers the onclick event and invokes the event handler SubmitForm (Buy), which is the value of the pending Form Name property. If you want to submit the form after you click the button, you can call the Submit () method of the Form object in the event handler:


function SubmitForm (f) {    f.submit ();  }

This is a default setting, so let's take a look at setting the HTML button tag style:

Let's show you a complete code example:

<!doctype html>

The effect of this

This effect is not very obvious, than the default time to look much better, until we learn JS, we can also use JS technology to set the default button more beautiful.

OK, the above is about the HTML button label style settings, as well as the beautification of the style of the summary (want to learn more to topic.alibabacloud.com), there are questions can be asked below.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.