Start learning with our library of video tutorials taught by experts. Get started

Up and Running with Bootstrap 2

Styling buttons


From:

Up and Running with Bootstrap 2

with Jen Kramer

Video: Styling buttons

You might have noticed the learn more link next to the session names here on this program. They aren't styled really nicely. It would be so much better if they looked more interesting and certainly more compelling to click on them. Fortunately, Bootstrap comes with a number of styles that will make those links more interesting. In fact, we can make all of those links look exactly like buttons if we wanted to. So I'm going to go ahead and apply some treatments to these learn more links to make them look more interesting, more clickable, pop-off the page a little bit more than they do right now.

Watch this entire course now—plus get access to every course in the library. Each course includes high-quality videos taught by expert instructors.

Become a member
Please wait...
Up and Running with Bootstrap 2
2h 38m Beginner Oct 12, 2012

Viewers: in countries Watching now:

Bootstrap is a free web development tool from Twitter that, with a little bit of CSS and JavaScript experience, makes building websites quick, intuitive, and fun. Author Jen Kramer explores its 12-column grid layout; typography and icon libraries; fully functional components like nav bars, buttons, and tabs; and much more. This course also shows how to add JavaScript extras like dropdown menus, modal windows, and photo carousels.

Topics include:
  • Understanding the difference between default and fluid grids
  • Nesting with fluid grids
  • Creating a thumbnail gallery
  • Adding block quotes and lists of text
  • Incorporating images and icons
  • Adding breadcrumb navigation and pagination
  • Using tabs and pills navigation
  • Making the nav bar responsive with JavaScript
  • Adding dropdown menus to the nav bar, tabs, and pill
Subjects:
Web CMS Blogs Responsive Design Web Design
Software:
Bootstrap
Author:
Jen Kramer

Styling buttons

You might have noticed the learn more link next to the session names here on this program. They aren't styled really nicely. It would be so much better if they looked more interesting and certainly more compelling to click on them. Fortunately, Bootstrap comes with a number of styles that will make those links more interesting. In fact, we can make all of those links look exactly like buttons if we wanted to. So I'm going to go ahead and apply some treatments to these learn more links to make them look more interesting, more clickable, pop-off the page a little bit more than they do right now.

So if you go to Dreamweaver and scroll on down to the first instance of these learn mores, which I think is around line 24, Art in Unexpected Places, you'll see that we have here the a tag with a learn more link inside of it. There are a number of things that we can do to give this a treatment. So one thing that we could do is simply use that small tag which I covered in a previous video, and you can wrap the small tag around the link itself, and if I just save that, Ctrl+S or Command+S to Save, and Refresh this inside of Firefox, you'll see that I've now made the text slightly smaller next to the names, which is good.

It doesn't look like it's competing with the name of the session anymore as it did before. If you take a look at Art in Full Bloom, it looks like it's Art in Full Bloom learn more as opposed to Art in Full Bloom, learn more. So this is pretty good, but we can make it a lot better using Bootstrap's button classes. So I'm going to go back into Dreamweaver, and I'm going to pull that small tag out. And instead, I'm going to go ahead and apply some classes. So at the most basic if we apply a class inside of the href tag here, you set a class of btn for button, and save that and take a look at it in Firefox, Refresh one more time.

You'll see that the learn more link here actually looks like a button. It's squared, it has rounded corners, it has the word learn more in it. When I roll my mouse over it, it looks like the button is slightly depressing. So that I think is definitely an improvement over what we have for the other learn more links here on the page right now. One of the other things you might be interested in doing is adding some kind of color to it. Those are available to you as well. Back to Dreamweaver here, as an additional class that we can add on here, there is btn-primary, that will make this button a blue color, sort of the primary styling for buttons on a Bootstrap web page.

So if I go ahead and Save that, and I Refresh this inside of Firefox, you will see that the button becomes blue. We've seen this before, we did this in the Hero unit, and when you roll over it, you'll see that the color does change a little bit, but we have a few more options. So if I scroll on down the page, the next instance of this, and I give this a class of btn and btn-info, this is going to make a light blue button. And I can keep on going down the page. There's a number of these, so let's just go ahead and put them all in, class for the next one, remember to put in btn for the generic buttons styling and then the second class will apply a color to it.

So btn-success will give you a green button. Here at the next link, btn btn-warning will give you a yellow button. Down here, btn btn-danger will give you a red button, class= that does help.

And then one more down here, class="btn btn-inverse" which will give you a black button. So I'm going to go ahead and Save this, and we can put it in Firefox and Refresh, and we'll have multicolored buttons, so you can see all the different color buttons that you have here that all ship with Bootstrap. Now notice the names of the classes that I gave you for these button-primary, button-info, button-success, button-warning, button-danger, and button-inverse. None of these are tied to a color name, and that's done very deliberately so that you can override these colors with your own colors.

So you can think about these buttons in terms of their functionality, the primary button, treatment that you're going to have, an informational button, a button indicating success, a button indicating a warning, and so forth. That is why these names exist, and that's why there are so many of them inside of Bootstrap. One final thing we can do with our buttons is we can change their size. So back to Dreamweaver again here for a moment, and I'm going to go back on up to the top page, back to line 24 where we have our first button. There are different sizes of buttons that come with Bootstrap.

We've been seeing the default size here, so there are three other sizes that are available. So I'll go ahead and show those to you as well. If as a third class you add to this tag, btn-large, you'll make a large button. We did that with the Hero treatment in the previous video. Or if the next one here, if you say btn-small will make a smaller button, and we can go even smaller down here with the success button, btn-mini, which will make a very small button.

So once again, go ahead and save this, take a look at it in Firefox, and you'll see we have a large button, we have a small button. You can compare that with this yellow button down here at the bottom, which is the standard size. So we have a small button, and we have a mini button. So you're welcome to go ahead and try out those particular classes and see what you can do here in the web page. I recommend not overriding any of these colors just yet. I'm sure you're more than capable of doing that in the CSS, but I have a way that I'd like for you to do that.

And just wait a couple more videos, and I will cover how to override the core CSS with your own.

Find answers to the most frequently asked questions about Up and Running with Bootstrap 2.


Expand all | Collapse all
Please wait...
Q: I am trying to create the image carousels shown in this course, and they are not functioning properly. The custom.css file seems to be missing from the exercise files and I think this is the reason. Can you provide it?
A: custom.css isn't created until the carousel indicators are added. However, these styles have to do with the way the indicators look, and nothinghas to do with the way the carousel functions.
 
Are you sure you're working with Bootstrap 2.x? You download that from here: 
http://getbootstrap.com/2.3.2/. The carousel changed radically between Bootstrap 2.x and Bootstrap 3, and this course might not work with version 3.
Share a link to this course
Please wait... Please wait...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.
Upgrade now


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Upgrade now

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Up and Running with Bootstrap 2.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Welcome to the redesigned course page.

We’ve moved some things around, and now you can



Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked