Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Styling buttons

From: Up and Running with Bootstrap 2

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.

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.

Show transcript

This video is part of

Image for Up and Running with Bootstrap 2
Up and Running with Bootstrap 2

32 video lessons · 20326 viewers

Jen Kramer
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

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.


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.

Join now Already a member? Log in

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 preferences from the dropdown menu.

Continue to classic layout Stay on new layout
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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.