How to customize the default Bootstrap 4 css styles
Good morning, everyone today we are going to look at how to override. Bootstrap styles. It looks very boot strappy to start with. We're going to customize it a bit to change it to look like this. There we go. A lot less bootstrap. E. Okay. And we're going to do a couple of things. We are going to show you how to completely override the styles, but also how to just work within the styles that bootstrap have created. Often there are styles that have been applied that we want to change and bootstraps pretty helpful and have actually created alternatives for them. So we do a mixture of overriding and just finding alternatives. Well, in this morning's video where I have the crankiest voice that I can't get rid of because it's real early. See in the video, All right, to override our styles. We're going to close down our kind of like throwaway html. We're using we're going to open up our index page by double clicking it. Cool. So let's have a little look at the CSS so you can actually click o...
n this link here. Okay, if you hover above it on my Mac it's command and click I'm sure on a pc it's control And click OK. And then click it, open it up and that my friends is the CSS bootstrap gives us Holy smoke. It's a mini ified version which looks more complicated than it is just Okay, but it's all in there. It's just cut down to the smallest possible size. Okay, so if I go find so I'm just using my find find. Okay, let's look for our H one and you can see there's five occurrences 12345. And this first one is kind of more of a zeroing code by the looks of it. Lots of stuff gets its margin set, I don't know just a little bit. So the margin top zero margin bottom gets override ID. Okay, over here for one The H one size. Okay, get set to 2.5. So there's some stuff going on that I can figure out and then start to override now. What you don't want to do is actually start adjusting this file because you can download bootstrap dot min dot CSS and actually start editing it. Get Bootstrap actually has a non modified version that you can start adjusting, but it's best to just leave Bootstrap do its own thing and override it, it gets way too complicated to start adjusting the specific file. So what we do is in visual studio code is you create your own CSS sheet. So let's create it first over here. Right click new file, let's call it styles. Just call it style dot CSS Okay? And in my I'm gonna drag it over here. Okay, and in html I'm going to underneath my bootstrap. CSS I'm going to add my own link. Okay, so link CSS and it's happen lee called it. Starlet says this not by default, just by luck. Alright, so the thing is the big thing is it needs to be underneath Bootstrap okay for it to work properly. Let's go and change something. So at the moment let's have a look. I'll start our browser. Okay? It is set to a specific font. Let's go and change the body copy font. Okay, so in here we can say buddy, we're going to pick a font style at the moment. I'm just going to pick one of the no not font style font family. Okay. And we're going to pick one of the defaults. Okay. And this one is going to be something strange, will use impact Kane, and I'm going to preview in the browser and you'll see everything has gone and changed. So we're going to leave their CSS all the way alone and just work on the top of it. Well, we're gonna have to do is sometimes figure out what bootstrap has called things to override it properly and I'll show you how to do that a little bit later on, let me show you what will happen and what you have to fight with if you get this below your style dot CSS you see back to the way it was, you're like, hey, but I said b body B impact or that word. Okay, so just got to make sure that that's around that way. So that's overriding a style very often though, you won't actually have to override a style you'll just find another appropriate bootstrap style because they're giving you loads, So what you end up doing is let's say let's look at this fella. Okay, Is I'm just going to get it here and that sliding thing down the bottom is annoying me, but let's say that's the H one. Okay, this thing here, let's figure out what that is, first of all. Okay, so there's a little trick you can do in chrome, you can right click it okay and go to inspect and whatever thing you had kind of highlighted, it'll show you in the html, what it actually is and you can see there's a P class with AARP with a class of lead on it. Okay? So let's go and have a look at our html. Okay. And where is it? So navigation underneath navigation, jumbotron, So P class would lead on it. You're like actually I just wanted to be a regular PE class. So instead of trying to style the lead class and you want to make it look like this. Okay, Just the regular old P tag and just go and remove this or find out what it does and see if there's an alternative that you like. So grab it, copy it and let's have a look at the get bootstrap site. Okay, documentation. And let's see if we can search for their lead. Oh, a little bit faster. It is there? So it is on their typography, so it's under content typography and there's a bunch of different options in terms of styling. So these are the H ones by default. Okay. Um, this is weirdly api class with a style of H one applied so you don't actually have to have it the heading one to be a nice big bit of type Other things. Oh, there is. There's a class here of a muted text you can see here, it's made it all kind of faded out. This is where you start kind of exploring bootstrap and finding things you like a display option. So H with a display of one gets huge. Okay, I lied. Okay. Makes a pair of standing out by lead. You can adjust that. You can go now and style this class because you want all the leads and all the pages to be slightly different bits italicized or something or you can go through and actually just say I want to remove it. Let's go. And in our case just remove the class. Everything except for the square brackets now. It should just be a regular old Bit of text like the top one. Or we can say let's use one of the other ones we found. Mm hmm. What have we found? Let's use display one. I'm not sure if you what happens when you put display one on an H on a P. Tag. Let's go. It's exciting. Let's do it. And here my P tag is gonna have a class class of Not lead. What was it called? Display high from one I think display hyphen one ticket check in the browser. Whoa. It's a big first paragraph and man that font that we picked. Don't worry, we're not sticking with that font. It was just a for instance impact. There's going to be a bit of time at the beginning where you're like, oh man, how much time do I want to spend going and learning this stuff versus just overriding it. There's nothing wrong with overriding and just saying I'm going to add my own class and do it. But it is handy to start understanding what these things do, figuring out if some of the hard work is being done for you. But in our case like lead isn't super exciting. You can just override it or make your own one but have a look through the rest of this topography one. You can see there's lots of cool stuff here. Bold Italicize, you can see all the shortcuts for it all. You can see there's a highlight one. Okay. You can add that as a like a little span tag wraps around the outside. Okay. And it will highlight it fancy. Okay, we're not gonna go through them all. What I really wanted to point out was that sometimes you override it by actually just going and doing it over the top and then sometimes you actually just figure out what the class that currently is applied and then go and change it. There's lots of stuff that we're going to cover later on in the course that are just like this is kind of a weird cool one. I really like it. This is adding a margin of four. Okay, four rims, Katie D Y axis. So up and down. So there's a horizontal ruler. Okay, Which is this fella here? Okay. Where's my ruler? Where did the water go? There? It is there, see this line? Okay. This line running through the center there, you have to zoom in editor because it's pretty small and thin but there is padding off four rings top and bottom, not left and right. Okay, top and bottom because it uses the Y axis. So there's some kind of like naming conventions that we're going to get used to as we go along. So for the rest of this video, I'm just going to do stuff we've done before just to tidy this thing up. First of all, I'm going to get rid of my display class and add back my lead. I'm going to bring in some fonts. Okay, we've done this before, but if you want to practice follow along with me. So google dot com slash fonts. Okay. New endeavored fonts dot google dot com. Okay. And I'm looking for two fonts for this particular um website. So the ones I want is this one here called a real fat face and the rest of the text is going to be open sans light. Probably open sans light plus with a bit of open sans bold. I think that's the only two that I used. Alright, so let's do this. Let's do april that face and add him. And I'm going to do open sands. Open sands. Cool. Let's have a look down here and let's say open sands, let's customize it. I want, I don't think I used regular, I just use that and bold. Okay, and when I get to april fat face I get a lot of that's open sans and underneath it is april okay, and just there's only one size for that font. So it was just the regular. And what we're gonna do is we're going to embed it, we're going to grab this at the top, copy it, make sure it goes above our CSS sheet. Okay, hindi remember does it go above bootstrap or below bootstrap? It works either way, let's save it. And what else we need, we need to actually apply that to our styles. So let's grab both of these because we will use both of them. It's over here. I want my I'm just gonna dump them in here willy nilly, I want all of my font family to be a default of open sense and I'll make it a default of I need to change it to white but probably a little later on. Once I start coloring my site. How does it look at the moment if I do wait too early I'm not going to be able to see all this text. Yeah, we'll change it a little bit later on But I wanted to be a font weight of the light. Okay that I was using and over here it's described as 300. That's the light for that one. Cool. The font that I want to do, I want to do an H1. Okay. And that's what I want to use my april for actually had to leave the wrong one. Go back then. Remember fonso just says I want you to be april if you can't find it, go and find the default cursive font. Okay. It's the one that's going to be the fanciest one on your machine. This one says open sands if you can't find it. Whatever the default sans serif is, which is probably going to be a real or helvetica but it should load because we've told it up here load from google and google is pretty consistent so we've overriding some bits, let's have a little look there's a document there. It is there Okay so everything that's not our age one is now open sans light and our heading here is april Alright, one last thing I want to do is add a background gradient. Okay we're going to jump in here and I'm going to say you pause it now and reckon and see if you can do it. Okay. Remember our background gradient. Okay. It's going to be. I've got the colors in your or are they your exercise files? Okay. N project for Okay. There's a document in there called Project for text. Open that up. And those are the two colors I want you to go for. Okay. See if you can do it without checking and just see how you go if you can remember it. So go on, pause it now. All right. How'd it go? You remember where to put it went on the body? Okay. And you remember what it was Cool because it's a weird one, right? It's background hyphen image then you decide where it's going. We're gonna use linear gradient. And inside these brackets here we decide the direction. I love this. Normally nothing makes its abbreviated short stuff, but um to bottom right. K means is going to go from top left to bottom, right comma. And then we're going to put it in our two. Tell us about these two can't use the hyphen. I've just added that in there. I should take it out of the text. Actually confusing and just a comma between them. So I don't need that little hyphen there. Well those are the two colors. It's gonna make sure I close it off. I can't see the side, we're here right on the edge there now. That one's doing it by default. Why isn't rapping on this side. I sure it turned it on. It's just at the edge of where it should wrap. There we go. Turn it back on. Alright, let's save it. Let's have a little look and there we go. Look at that. Beautiful. Alright, so we've customized our style sheet a little bit overriding things and also you're going to spend a lot more time probably figuring out what these classes. What does this BG light and what does it do? And can I is there a B. G. Duck? I bet you there is. Okay. And kind of having a look at the documentation and either finding something that already exists or at least close to what you want and then doing a slight adjustment over the top that my friends is bootstrapped life. Alright, onto the next video.