in Education by

Explain Bootstrap buttons and its styles.

1 Answer

0 votes
by

Buttons play various roles in websites and applications and are used to submit, reset, show and hide on click of button, link button etc.

By using Bootstrap we can easily create and customize the buttons.

Bootstrap Button Styles

In Bootstrap different classes are used for styling the buttons and styles can be applied to any element like <a><button> and <input>.

Bootstrap provides seven styles of buttons,

button

To apply the button styles, Bootstrap provides the following classes,

 

  • .btn-default - Default gray color Standard button
  • .btn-primary - To indicate primary action button
  • .btn-info - Used for informational alert messages
  • .btn-success - Indicates a successful or positive action
  • .btn-danger - Indicates a dangerous or negative action.
  • .btn-warning - Indicates caution should be taken with this action
  • .btn-link - Button looks like a link while maintaining button behavior

Example

Bootstrap Button Styles,

In this example we will create buttons and by using above classes we will apply styles on buttons through the following code.

  1. <!DOCTYPE html>  
  2. <html lang="en">  
  3.   
  4. <head>  
  5.     <meta charset="utf-8">  
  6.     <title>Bootstrap Part4</title>  
  7.     <meta name="viewport" content="width=device-width,initial-scale=1">  
  8.     <link rel="stylesheet" type="text/css" href="css/bootstrap.min.css"> </head>  
  9.   
  10. <body>  
  11.     <div class="container">  
  12.         <h1>Button Styles</h1>  
  13.         <!--Button Style1:Default--><button type="button" class="btn btn-default">Default Button</button>  
  14.         <!--Button Style2:Primary--><button type="button" class="btn btn-primary">Primary Button</button>  
  15.         <!--Button Style3:Info--><button type="button" class="btn btn-info">Info Button</button>  
  16.         <!--Button Style4:Success--><button type="button" class="btn btn-success">Success Button</button>  
  17.         <!--Button Style5:Danger--><button type="button" class="btn btn-danger">Danger Button</button>  
  18.         <!--Button Style6:Warning--><button type="button" class="btn btn-warning">Warning Button</button>  
  19.         <!--Button Style7:Link--><button type="button" class="btn btn-link">Link Button</button> </div>  
  20.     <script src="js/jquery-2.1.4.min.js"></script>  
  21.     <script src="js/bootstrap.min.js"></script>  
  22. </body>  
  23.   
  24. </html>  

Output

Bootstrap Button Styles

Related questions

0 votes
    Explain the Bootstrap basic table?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain the basic structure of the Bootstrap grid....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain Bootstrap Grid System....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Explain the use of Bootstrap CSS class="navnav-list"....
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you give a style to images in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What are Containers in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What are the advantages of Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can we create a dropdown menu in Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create Fixed Layout with Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you create a web page using Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    How can you get Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Why choose Bootstrap for building websites?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What is Bootstrap?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    What do you understand about Responsive websites?...
asked Apr 4, 2021 in Education by JackTerrance
0 votes
    Which of the following Bootstrap button styles indicates that caution should be taken with an action? a).btn-link b).btn-danger c).btn-warning d).btn-info...
asked Apr 28, 2021 in Technology by JackTerrance
...