Thursday, 3 May 2018

003 Bootstrap Button

Bootstrap Button

Button Styles

Bootstrap have 7 classes to style a button.These are
  1.  .btn-default
  2.  .btn-primary
  3.  .btn-success
  4.  .btn-info
  5.  .btn-warning
  6.  .btn-danger
  7.  .btn-link
Below is the Sample application of the styling

Code
<!DOCTYPE html>
      <html lang = "en">
      <head>
      <meta charset = "utf-8">
      <meta name = "viewport" content = "width = device-width, initial-scale = 1">
      <title> </title>
         <link href = "//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel = "stylesheet">
      </head>
      <body>
      <div class="container">
<h2></h2>
         <button type="button" class="btn">Basic</button>
         <button type="button" class="btn btn-default">Default</button>
         <button type="button" class="btn btn-primary">Primary</button>
         <button type="button" class="btn btn-success">Success</button>
        <button type="button" class="btn btn-danger">Danger</button>
        <button type="button" class="btn btn-info">Info</button>
        <button type="button" class="btn btn-warning">Warning</button>
       <button type="button" class="btn btn-link">Link</button>
</div>
</body>
</html>

Output
Button Size



Bootstrap 4 introduces new class for buttons
  1. btn-secondary
  2. btn-dark
  3. btn-light
Below is the Sample application of the styling

Code

<!DOCTYPE html>
        <html lang = "en">
        <head>
         <meta charset = "utf-8">
                   <meta name = "viewport" content = "width = device-width, initial-scale = 1">
                    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
                   <body>
                          <div class="container">
               <h2>Button Styles</h2>
                              <button type="button" class="btn btn-secondary">Secondary</button>
                              <button type="button" class="btn btn-dark">Dark</button>
                             <button type="button" class="btn btn-light">Light</button>
              </div>
       </body>
</html>

Output :


  

Button Sizes

Bootstrap provides classes for define size of button
  1. .btn-lg
  2. .btn-md
  3. .btn-sm
  4. .btn-xs

Code
 
<!DOCTYPE html>
     <html lang = "en">
     <head>
     <meta charset = "utf-8">
     <meta name = "viewport" content = "width = device-width, initial-scale = 1">
     <title>Button Styles</title>
        <link href = "//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel = "stylesheet">
</head>
<body>
<div class="container">
      <h2> </h2>
            <button type="button" class="btn btn-primary btn-lg">Large</button>
            <button type="button" class="btn btn-primary btn-md">Medium</button>
            <button type="button" class="btn btn-primary btn-sm">Small</button>
            <button type="button" class="btn btn-primary btn-xs">XSmall</button>
</div>
</body>
</html>

Output
Button Styles




Block Level Buttons
A block level button expands the entire width of the parent element.

Code

<!DOCTYPE html>
<html lang = "en">
<head>
        <meta charset = "utf-8">
        <meta name = "viewport" content = "width = device-width, initial-scale = 1">
        <title>Block Level Buttons
      </title>
            <link href = "//maxcdn.bootstrapcdn.com/bootstrap/3.3.1/css/bootstrap.min.css" rel = "stylesheet">
</head>
<body>
<div class="container">
           <h2>Button Sizes</h2>
           <button type="button" class="btn btn-primary btn-block">Block Level Buttons</button>
</div>
</body>
</html>



output

Block Level Buttons

Button Sizes




Bordered Buttons

Bootstrap 4 provides eight Bordered buttons
  1. btn-outline-primary
  2. btn-outline-secondary
  3. btn-outline-success
  4. btn-outline-info
  5. btn-outline-warning
  6. btn-outline-danger
  7. btn-outline-dark
  8. btn-outline-light

Code
<div style="width:300px;">
       <!DOCTYPE html>
       <html lang = "en">
       <head>
<meta charset = "utf-8">
     <meta name = "viewport" content = "width = device-width, initial-scale = 1">
<title>
</title>
         <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
</head>
<body>
<div class="container">
<h2></h2>
        <button type="button" class="btn btn-outline-primary">Primary</button>
        <button type="button" class="btn btn-outline-secondary">Secondary</button>
        <button type="button" class="btn btn-outline-success">Success</button>
        <button type="button" class="btn btn-outline-info">Info</button>
       <button type="button" class="btn btn-outline-warning">Warning</button>
       <button type="button" class="btn btn-outline-danger">Danger</button>
       <button type="button" class="btn btn-outline-dark">Dark</button>
       <button type="button" class="btn btn-outline-light ">Light Dark</button>
</div>
</body>
</html>
</div>

output
Bordered Buttons

Button Classes with Different HTML Elements
 
<div style="width:300px;">
<!DOCTYPE html>
<html lang = "en">
<head>
<meta charset = "utf-8">
<meta name = "viewport" content = "width = device-width, initial-scale = 1">
<title>Button Classes with Different HTML Elements
</title>
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.2/css/bootstrap.min.css">
</head>
<body>
        <div class="container">
                    <a href="#" class="btn btn-info" role="button">Link Button</a>
                     <button type="button" class="btn btn-info">Button</button>
                     <input type="button" class="btn btn-info" value="Input Button">
                     <input type="submit" class="btn btn-info" value="Submit Button">
        </div>
</body>
</html>
</div>

Output

Button Classes with other Elements
Link Button

Button State
Bootstrap allow to set state of Button.



.active css is added for this purpose.

Button State




.disabled disable the button


Button State




বাঙালির বেড়ানো সেরা চারটি ঠিকানা

  বাঙালি মানে ঘোড়া পাগল | দু একদিন ছুটি পেলো মানে বাঙালি চলল ঘুরতে | সে সমুদ্রই হোক , পাহাড়ি হোক বা নদী হোক। বাঙালির ...