Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
This is HTML file 03_03.html from your exercise files folder. Copy it into your Bootstrap folder, and display it in the web browser. And you can follow along with me. This is a homepage that we put together in the previous chapter, where we were talking about grids. And this got the Jumbotron here and we've got some little boxes with pictures. Aren't they cool? One of the things you might've been looking at through this page are these "Read more" links down here, but you know they're just links and that's totally fine. There's nothing wrong with the way these are, but wouldn't it be fun if we could make those read more links look a little bit more clickable? Because right now they just sort of blend into the page.
They don't really stand out at all. So one way we can do that is to turn these links into buttons. And one of the wonderful things about Bootstrap is how many ways you can style a button. If you go to the Bootstrap website getbootstrap.com go to the CSS portion of the website and click on Button you'll have more then you ever wanted to know about buttons available to you. They come in many colors they come in many sizes. They come in disabled states and so forth. There's a ton you can do with buttons, and so I'm going to show you a little bit of that now.
So I'm going to open up 03_03.html inside of my Sublime Text editor, and I'm going to scroll on down here to the area around row 3. And I'm taking a look at line 39 to start with. Pretty simple little bit of code. It's a paragraph tag an a href, words of Read more/a/p. So in this /a tag I'm going to add some classes, so I'll add a class here. And to this I can add BTN. BTN is the first class that you need to add and that indicates that this is a button.
And then you're always going to need to follow this up with a second class. The BTN by itself will never stand alone. It doesn't really do much in terms of styling. Feel free to go ahead and take a look at it by itself, but it doesn't do much. You'll always need to add something else to it, so if I say btn-default, for example, this is going to give me a default button. If you save this page and you refresh it inside of your browser you'll see that we now have a button here. Hey look at that. So it's a white button, when you hover over it, it turns a nice light gray.
So that's the default button. Maybe it stands out a little bit more than those blue links but there's more that we can do here to make this a little bit more prominent. So rather than button-default, one of the other options that we have would be primary. If you go ahead and save that again, button primary is going to make us a lovely blue button. So there's our blue button and when we mouse over it it turns a shade darker. So there's several other treatments that we can use here with our buttons, and I'm going to move on down here to the second button, which is on line 45 here.
And I can add classes to this as well. So I could say, class equals, let's say, btn, again. Let's say btn-warning. Which is going to give us a lovely orange button. And I could say, btn-lg. And this is going to give us a big button. So if you go ahead and save this. And you refresh in your browser window. Here we go. Now we have a big orange button here for Read more. Scroll on down a little further. So, now I'm on line 51, here's another place I can put in a button.
I can say here are class of once again btn always. Let's say btn-success, which will give me a lovely shade of green. And to this I could add btn-xs. Which'll give me an extra small button. So if we go ahead and save that and refresh your web page, you'll see we have a little green button. And then the last little trick I want to show you is down on our fourth button which is on line 57. We're going to go ahead and we're going to add a class of BTN as you always have to do. Btn-danger.
Danger's going to give us a lovely shade of red and btn-block. So what btn-block will do is it's going to treat this button as a block level element. In other words, it will be as wide as its containing element. In this case its containing element is a paragraph. So it's going to be as wide as the paragraph. How big is the paragraph? It's as wide as its containing element, and that happens to be this div tag up here on line 53. So it's essentially going to span this entire column in its width. In this case, the column MD3 or the column XF6. So if I refresh my web page here.
And there we go. We have a great, big, huge red button that spans the entire width of that column. So, buttons? Aren't buttons great? Buttons come in all shapes. They come in all sizes. They come in many, many different colors. And you can find documentation on buttons on the Bootstrap website, getbootstrap.com. And you'll find all kinds of details there about the cool things that you can do with buttons.
Get unlimited access to all courses for just $25/month.Become a member
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
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.
Your file was successfully uploaded.