This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

How to change the default Bootstrap 4 buttons size & color

Daniel Walter Scott

Download Exercise Files Download Completed Files

Contents

Certificates

We’re awarding certificates for this course!

Check out the How to earn your certificate video for instructions on how to earn yours and click the available certificate levels below for more information.

Introduction

I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link: https://www.bluehost.com/track/byol/byol_webess_113

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
Hello there, we are going to tackle this button here. We're going to go from blue and solid, to white and outlined, and bigger and better. It's going to have a cool little Hover as well. We're going to do all that now, using a mixture of our own CSS and Bootstrap's goodness. 

So what do we want to do to this button? First of all I want to push it down a bit, because on my mock-up here it is down a bit further. So I want to go and do that, nice easy one. So the button here, where is he? Jumbotron, he's inside of it, there's the button. We're going to add a class of, remember, it was Margin, and I want to add it to the top, and I want it to be, not sure, I'll try 4. Let's give it a go, definitely a nice bigger gap, that will do for me. 

Next thing I want to do is outline it, because it's a solid blue color. I want to make it a white outline, like my mock-up here. Instantly I was like, "No way Bootstrap does that, they don't do an outline button." So I started making my own Class only to discover later on, making this tutorial, I'm like, "They do do one." Sometimes you could be like, "They don't do that", and sometimes you just actually need to check. 

So in here I typed in 'buttons', and what do we get? Buttons, Button tags, oh look, there's an Outline Button. Going to click on 'Button/Buttons', and get to the right page, and there's lots of them. There he is there, he's Outline Buttons. So I just need to use the Outline Class of, I want this one. So I want the Button Outline of probably white. They've got a light one, do they have white there? They don't seem to have it there, let's test it. Maybe they couldn't have it because you couldn't see it. Let's give it a roll. 

So we're going to say 'btn'. Actually not there, and I want a separate Class, I've already got one. There's already something applied to it, called BTN primary. So BTN outline. We're going to guess for white, to see if they do it, let's check it. Does not do white because it's freaked out. It does a light version, and now you're going to decide how much, the light one, how much do I really want it to be white? Why don't they have a white one? So let's have a look now, light. Blue, you're like, "No, has to be white, Dan." How do we go and change it? Now we're going to go through and say, actually-- so it's this kind of like think it through. So there's a few things applying to this button, There's something called, there's an A-tag, something called a BTN, there's something called BTN Outline. Then there's a Button Large, by the looks of it. So I imagine I could put in SM to get a small one, and we added the margin to the top, of 4. 

So over here we could say, "Let's just do all buttons," let's do BTN. Well, '.btn', come on, Daniel, btn. Let's say I want the color, we don't want the color, we'll do a background. Let's have a little look, background color. I know what it is, but I'm trying to, like tell a story here. Background color, white, is that right? You're like, "It's not what I want, I want the outline to be white." The other problem is that, that btn, background white, let's change it to red, just to show you. I think it's too generic, because it's getting used there and over here. So we need to make sure that, maybe attacking the button is not quite what we want to do. 

So instead of just the button, we'll do this, a slightly more specific, BTN Outline Light. So this guy, it's going to be this, and it's not going to be the background color. So we're going to delete that. It's going to be the border. Color of white, thank you very much. Nice. So it's kind of there, you're like, "Awesome, I've got it." Then you're like, "Ah, not the right color," so a bit of both. It's me and Bootstrap, high-five, we're doing stuff.

One of the other things we might include here is the Hover. That's I guess one of the perks of using Bootstrap, is that, you might have decided in your head, like, "Why you're bothering using this Class, when it doesn't do anything," or really what you want, it did the line, but the other thing that this kind of invokes is that it pulls through, like the Hover Class, because remember, when I first started using it, it was blue, with a dark blue background. So when I called on this one, the light version, it kind of switched out the Hover Classes, all those Pseudo Classes as well. So Bootstrap is doing lots of things. 

What else we want to do? We want to do a Pseudo Class, so we are going to grab all of this, and you remember Pseudo Classes, don't you? So you smash on a colon at the end with no space, and type in 'hover'. So I want this particular Class to be attacked. So I want this particular Class to be looked at, and I want the Hover Pseudo Class to work with it. So I don't want this, what I want to do is maybe the background color now. 

So background color, I want it to be white, but I want it to be-- I'm going to click on it. I'm going to say, white, but quite transparent. Somewhere like that. 20%. Let's have a little look. Now my Hover, can you see, just kind of hinting there. Good hinting, Dan. Let's look at some of the other button-ey things. So sizes, ours is already a Button Large. Seems to be only Button Large and Small. I want mine to be extra big. There's no extra big here, so we're going to have to kind of style it a little bit more. So let's jump back in, and you're like, "Okay." I'm just going to add it to this one here, add some Padding, you're like, "No way, we've got Classes for that, for Bootstrap," don't we? 

We've got Margin Top. Remember we can add some Padding, and the left and the right, you remember, is X, and I want that to be 5, and I would like the up and the down to be something that's a little smaller of Y. So Padding, left and right, 5, top and bottom, 3. We can make a giant button. Again teamwork, me and Bootstrap doing stuff together, being quick, doing all the hard yards, but then Dan, the Designer, spending ages trying to fight with Bootstrap, to get him to do what he wants, but with all the checks and balances, for what I've been able to throw in real quick, especially with the Navigation and all the Media Queries, I think we're still on to a winner, with Bootstrap. Thank You, Bootstrap.