So... you took the red pill. Welcome to the world of Twitter Bootstrap. While the bootstrap is a big dark hole full of scripts and styles and templates, we aren't going to bother with all of that. Nope, what we want to do is cherry pick the bits that we can use to spice up a Block Builder 2 page, and forget the rest.
So I'm going to show you a few easy things that we can do. Create buttons, add bootstrap classes to make them look nice, and add icons to them. Then on the next page, we will look at some of the ways that you can use buttons on your pages.
To create our buttons using the Bootstrap and Font Awesome styles, we need to reference their online and publicly available style-sheets. Do not save a copy of these and host them on your website, just copy and paste the links provided below.
<button class="btn btn-primary">
Example Button
</button>
<button class="btn btn-default">
btn-default
</button>
<button class="btn btn-primary">
btn-primary
</button>
<button class="btn btn-info">
btn-info
</button>
<button class="btn btn-success">
btn-success
</button>
<button class="btn btn-warning">
btn-warning
</button>
<button class="btn btn-danger">
btn-danger
</button>
Now we have some nicely styled buttons that we can use, and it's really not much more work that putting stock standard buttons on your page, is it? The next class we can add to our buttons, is to give them a full-width of the container. It would look nice if we had all our buttons an equal width, so I will set the button container to a width of 250px, and add a new class to the buttons. .btn-block
These are the same six buttons, with the btn-block class added to the button tag. The buttons are showing the class names I used for them as the button text. The copy and paste code below just have "Button Text" to keep the line length shorter ;-)
<button class="btn btn-default btn-block">
Button Text
</button>
<button class="btn btn-primary btn-block">
Button Text
</button>
<button class="btn btn-info btn-block">
Button Text
</button>
<button class="btn btn-success btn-block">
Button Text
</button>
<button class="btn btn-warning btn-block">
Button Text
</button>
<button class="btn btn-danger btn-block">
Button Text
</button>
Now that our buttons are looking good, it's time to add some icons to them. Font Awesome have over 360 different ones to choose from, and we use a tag in beside the button text to add the icon. It looks something like this...
<i class="fa fa-paper-plane"></i>
That class paper-plane would add a paper plane icon, suitable for putting on a submit or email button perhaps. We will use the exact same buttons as above, and this time add some some icons to them. The list of all the different ones available is at the Font Awesome Cheat Sheet page.
These are the same six buttons, with the Font Awesome icons and some appropriate button text added.
<button class="btn btn-default btn-block">
<i class="fa fa-expand fa-lg"></i>
See Larger Version
</button>
<button class="btn btn-primary btn-block">
<i class="fa fa-paper-plane fa-lg"></i>
Send
</button>
<button class="btn btn-info btn-block">
<i class="fa fa-info fa-2x"></i>
More Information
</button>
<button class="btn btn-success btn-block">
<i class="fa fa-check-circle-o fa-2x"></i>
Subscription Confirmed
</button>
<button class="btn btn-warning btn-block">
<i class="fa fa-warning fa-3x"></i>
You Are About To Cancel
</button>
<button class="btn btn-danger btn-block">
<i class="fa fa-close fa-3x"></i>
You Have Been Terminated
</button>
If you would like an easy way to create your buttons, then this website will allow you to build up custom buttons using the bootstrap classes. You can then just grab the code and paste it into a Raw HTML block. The icons used are the bootstrap ones called glyphicon. If you use this method then you don't need the head tag that links to the Font Awesome CSS. .
Comments
Have your say about what you just read! Leave me a comment in the box below.