Bootstrap (vi): button

Source: Internet
Author: User

1. Labels or elements that can be used as buttons

Although button classes can be applied to <a> and <button> elements, the navigation and navigation bar components only support <button> elements.

If the <a> element is used as a button and is used to trigger certain features on the current page instead of linking other pages or links to other parts of the current page, be sure to set the role= button property for it.

<aclass= "Btn Btn-default"href="#"role= "button">Link</a><Buttonclass= "Btn Btn-default"type= "Submit">Button</Button><inputclass= "Btn Btn-default"type= "button"value= "Input"><inputclass= "Btn Btn-default"type= "Submit"value= "Submit">
2. Button style

<Buttontype= "button"class= "Btn Btn-default">(Default Style)</Button><Buttontype= "button"class= "Btn btn-primary">(preferences) Primary</Button><Buttontype= "button"class= "Btn btn-success">(success) Success</Button><Buttontype= "button"class= "Btn btn-info">(General information) info</Button><Buttontype= "button"class= "Btn btn-warning">(warning) Warning</Button><Buttontype= "button"class= "Btn Btn-danger">(Danger) Danger</Button><Buttontype= "button"class= "Btn Btn-link">(link) Link</Button>
3. Button size

Do I need to have a different size for the button? use .btn-lg , .btn-sm or you can get buttons of different sizes .btn-xs .

<P>  <Buttontype= "button"class= "btn btn-primary btn-lg">(large button) Large button</Button>  <Buttontype= "button"class= "btn btn-default btn-lg">(large button) Large button</Button></P><P>  <Buttontype= "button"class= "Btn btn-primary">Default button</Button>  <Buttontype= "button"class= "Btn Btn-default">Default button</Button></P><P>  <Buttontype= "button"class= "btn btn-primary btn-sm">(small button) Small button</Button>  <Buttontype= "button"class= "btn btn-default btn-sm">(small button) Small button</Button></P><P>  <Buttontype= "button"class= "btn btn-primary btn-xs">(ultra-small size) Extra small button</Button>  <Buttontype= "button"class= "btn btn-default btn-xs">(ultra-small size) Extra small button</Button></P>

Adding a class to a button stretches it to the width of the parent element 100%, and the button becomes a block-level (block) element. .btn-block The specific example below ↓

<P>  <Buttontype= "button"class= "btn btn-primary btn-lg btn-block">(large button) Large button</Button>  <Buttontype= "button"class= "btn btn-default btn-lg btn-block">(large button) Large button</Button></P><P>  <Buttontype= "button"class= "Btn btn-primary">Default button</Button>  <Buttontype= "button"class= "Btn Btn-default">Default button</Button></P><P>  <Buttontype= "button"class= "btn btn-primary btn-sm">(small button) Small button</Button>  <Buttontype= "button"class= "btn btn-default btn-sm">(small button) Small button</Button></P><P>  <Buttontype= "button"class= "btn btn-primary btn-xs">(ultra-small size) Extra small button</Button>  <Buttontype= "button"class= "btn btn-default btn-xs">(ultra-small size) Extra small button</Button></P>

Bootstrap (vi): button

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.