content logo

Bootstrap Buttons:

Bootstrap Expanding Button with Icon

When you think of pressing a button, it sounds like a really simple and easy to do task, right? Then this is exactly how you should design your buttons in a website. The user should be able to interact with buttons with ease and if they are unable to successfully click on a button or tap it, it will lead to frustration and a negative experience. Another thing that could lead to bad user experience and loss of time is if the buttons are bunched up together too much which may cause the user to accidentally tap another neighbouring button. So, it is of utmost important that you make your user interface as intuitive and responsive as possible and offer the best user experience possible.

In this awesome new code, we have various Bootstrap expanded buttons with different sizes. These Bootstrap buttons are normally really small and display only the icon. The uniqueness, however, comes into play when you hover your mouse cursor onto it. in hover mode, these Bootstrap effective buttons expand in size to make clicking on it much easier. If you wish to have a Bootstrap button with icons in your website, using this code is highly recommended as it offers so much great options.

#

Bootstrap Expanded Button

#

Bootstrap Button

#

Bootstrap Effective Button

#

Bootstrap Button with Icon

<!-- This script got from frontendfreecode.com -->
<div class="container">
  <div class="row">
    <div class="col-sm-12">
      <p class="text-muted">Hover Over Buttons</p>
      <!-- demo starts here -->
      <p>
        <a class="btn btn-info btn-sm btn-collapsible"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-sm btn-collapsible"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
      <p>
        <a class="btn btn-info btn-collapsible"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-collapsible"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
      <p>
        <a class="btn btn-info btn-lg"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-lg"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
    </div>
  </div>
</div><a style="font-size: 8pt; text-decoration: none" target="_blank" href="http://frontendfreecode.com">Free Frontend</a>
                                                                            
.btn-collapsible {
  overflow: hidden;
  -webkit-transition: all 500ms ease-in-out;
  -moz-transition: all 500ms ease-in-out;
  -ms-transition: all 500ms ease-in-out;
  -o-transition: all 500ms ease-in-out;
  transition: all 500ms ease-in-out;
  max-width: 40px;
  white-space: nowrap;
}
.btn-collapsible.btn-sm {
  max-width: 34px;
}
.btn-collapsible.btn-lg {
  max-width: 50px;
}
.btn-collapsible span {
  opacity: 0;
  text-indent: -6px;
  display: inline-block;
  -webkit-transition: all 500ms ease-in-out;
  -moz-transition: all 500ms ease-in-out;
  -ms-transition: all 500ms ease-in-out;
  -o-transition: all 500ms ease-in-out;
  transition: all 500ms ease-in-out;
}
.btn-collapsible:hover {
  max-width: 300px;
  -webkit-transition: all 300ms ease-in-out;
  -moz-transition: all 300ms ease-in-out;
  -ms-transition: all 300ms ease-in-out;
  -o-transition: all 300ms ease-in-out;
  transition: all 300ms ease-in-out;
}
.btn-collapsible:hover span {
  opacity: 1;
  text-indent: 0px;
  -webkit-transition: all 300ms ease-in-out;
  -moz-transition: all 300ms ease-in-out;
  -ms-transition: all 300ms ease-in-out;
  -o-transition: all 300ms ease-in-out;
  transition: all 300ms ease-in-out;
}
/* Demo Related Styles */
body {
  background-color: #5c4084;
  margin: 50px;
}
.container {
  background-color: #fff;
  padding: 40px 80px;
  border-radius: 8px;
  text-align: center;
}
h1 {
  color: #fff;
  font-size: 4rem;
  font-weight: 900;
  margin: 0 0 5px 0;
  background: -webkit-linear-gradient(#fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}
h4 {
  color: #a990cc;
  font-size: 24px;
  font-weight: 400;
  text-align: center;
  margin: 0 0 35px 0;
}
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootswatch/4.5.2/flatly/bootstrap.min.css'>
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<!-- This script got from frontendfreecode.com -->

<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/bootswatch/4.5.2/flatly/bootstrap.min.css'>
<link rel='stylesheet' href='https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css'>
<style>
.btn-collapsible {
  overflow: hidden;
  -webkit-transition: all 500ms ease-in-out;
  -moz-transition: all 500ms ease-in-out;
  -ms-transition: all 500ms ease-in-out;
  -o-transition: all 500ms ease-in-out;
  transition: all 500ms ease-in-out;
  max-width: 40px;
  white-space: nowrap;
}
.btn-collapsible.btn-sm {
  max-width: 34px;
}
.btn-collapsible.btn-lg {
  max-width: 50px;
}
.btn-collapsible span {
  opacity: 0;
  text-indent: -6px;
  display: inline-block;
  -webkit-transition: all 500ms ease-in-out;
  -moz-transition: all 500ms ease-in-out;
  -ms-transition: all 500ms ease-in-out;
  -o-transition: all 500ms ease-in-out;
  transition: all 500ms ease-in-out;
}
.btn-collapsible:hover {
  max-width: 300px;
  -webkit-transition: all 300ms ease-in-out;
  -moz-transition: all 300ms ease-in-out;
  -ms-transition: all 300ms ease-in-out;
  -o-transition: all 300ms ease-in-out;
  transition: all 300ms ease-in-out;
}
.btn-collapsible:hover span {
  opacity: 1;
  text-indent: 0px;
  -webkit-transition: all 300ms ease-in-out;
  -moz-transition: all 300ms ease-in-out;
  -ms-transition: all 300ms ease-in-out;
  -o-transition: all 300ms ease-in-out;
  transition: all 300ms ease-in-out;
}
/* Demo Related Styles */
body {
  background-color: #5c4084;
  margin: 50px;
}
.container {
  background-color: #fff;
  padding: 40px 80px;
  border-radius: 8px;
  text-align: center;
}
h1 {
  color: #fff;
  font-size: 4rem;
  font-weight: 900;
  margin: 0 0 5px 0;
  background: -webkit-linear-gradient(#fff, #999);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  text-align: center;
}
h4 {
  color: #a990cc;
  font-size: 24px;
  font-weight: 400;
  text-align: center;
  margin: 0 0 35px 0;
}
</style>

</head>
<body>
<div class="container">
  <div class="row">
    <div class="col-sm-12">
      <p class="text-muted">Hover Over Buttons</p>
      <!-- demo starts here -->
      <p>
        <a class="btn btn-info btn-sm btn-collapsible"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-sm btn-collapsible"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
      <p>
        <a class="btn btn-info btn-collapsible"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-collapsible"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
      <p>
        <a class="btn btn-info btn-lg"><i class="fa fa-cloud-download"></i> <span>Download</span></a>
        <a class="btn btn-success btn-lg"><i class="fa fa-check"></i> <span>Publish</span></a>
      </p>
    </div>
  </div>
</div><div id="bcl"><a style="font-size:8pt;text-decoration:none;" href="http://www.devanswer.com">Free Frontend</a></div>

</body>
</html>
Preview