This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

Adding a full col image in bootstrap 4 & color the background of col

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_120

Comments

Video transcript

Hi there, in this video we're going to make this Founder Message. On the left hand side here we've got an image, which is going to help us kind of recapture our knowledge of responsive images, which we did quite a while ago, I'm going to recap that. We're going to build out this kind of one row, two columns layout here. It's going to break down on mobile, onto like two lines. Giant me, Founder Message. We're going to add Padding, what else we're going to do? We are going to get it to center within the box, and it's another recap of Flexbox getting items to center in the middle like we did, way, way, way back ago in the course. Let's go and put in this very cryptic message, from our good looking Founder here. Let's go do it. 

So this is the part we want to add, this kind of like Founder's Message, and the unique parts of it is that I've got rounded corners for no good reason, other than I want to show you how to do that. We'll do two kind of separate columns, because I want it to break down on mobile, to be kind of on top of each other. So let's look at doing that. So on VS Code, it's going to go underneath my Jumbotron, but before the Carousel. I'm going to put this in. This is going to be my 'Founder's Message', and what do I want? I want at least a row, and inside of that I want a column, but I want two of them. 

I want the first column, so, because it's Mobile first we need to say, I want it to break on to its own lines, so I want it to be a full 12-columns wide for mobile, but then later on when it gets to Medium, I want it to be, not sure, what is it? About that, let's say 4 and 8. So let's say 4, and this one here is going to be a col of MD. It's going to go up to 8. Now let's just put some basic text in here, just so that we can, see what's going on, to keep testing while we're working. Where is it? there it is, Test, Right down on mobile. Weird sample. 'Refresh'. Weird. 

I'll leave it into the course, but normally that refreshes fine. I don't have to click refresh. Maybe because I've got the testing open. Maybe having the Developer Tools, and the Inspect thing going on, kind of like freezes the code. So that looks like it's working. It's on 4, now I get down to mobile, and it should jump down to be on top of each other, 12 columns wide. 

Next thing I want to do, let's add some of this text. Then we'll add the image, actually do the image first. So in this one here, we're going to do our sweet responsive images. So I'm going to get rid of that. This one here, this first box, we're going to put in IMG. It's going to be in our Images folder, and it's the head shot of Dan. We want to add some Classes to it. Remember the one that says 'img responsive'. It was actually called 'IMG Fluid'. And Alt text, this is going to be, 'Daniel Walter Scott'. 'Meat Yogurt Founder'. Kind of keyword stuffing now, but hey ho. Let's have a little look at it, let's check it out. 

It is filling the column just fine. And fills the column over here just fine. When I get down to mobile, gets down to kind of a responsive mobile size-ish. A little bit big, but let's make it full width. So let's add the text to this part. There's going to be an H2 and some P-text. So in H2, because I've already got an H1, this is just going to say, 'Message from our Founder'. Weird case going on there. And I want some P-text, and a P-- I would like to have some Lorem, of just about 60. Nice, let's have a little look. 

It's in there, mobile, and it's in there at our Desktop view. Now what I want to do is, I don't want it to have this clear background. I want to put in a background color, because I want it to be white. And also want to show you how to add a background color. So we could-- like we haven't put in our own Class in here. We've actually just stuck to our Class, where is it? So there's a row, and here's a column. And it's this column here that I want to make a white background. Now if I was going to add some styling to col, or col 12 in this case, I would go here, make a style for it. Now the problem is, remember, I don't like styling the existing Bootstrap stuff. 

So what I probably do is make its own Wrapper tag inside of here. So I'd wrap with abbreviation, which is that first one there for me. And I'd say, let's make a, I don't know, a Founder Class. It would go and style that Founder Class to have a background of white, but I know that Bootstrap probably has a Background Class, and in this case it's going to be 'bg' of 'white'. And that should be all I need to do. They have a bg, a background of white black, light dark, primary, danger. There's a few other colors you can use. Let's add some Padding all the way around as well, so let's go into here and let's say, this thing here is background of white, but also has a Padding, and remember, if I don't put a top, bottom, left, or right, it assumed all sides, I'm going to put the maximum in, and there we go. 

It's kind of got a nice Padding around it. Actually what we might do, is try and get it to line in the center of the actual column itself. And how do we do that? We did it with Flex, remember, last time. If I do a center, like look for align, different kinds of alignments, vertical is what we want. Let's have a look at that. This is not going to work, so Align Middle works perfect for inline objects. So it says it up here, it says, great for in Inline, Inline Block, but not our Block elements, which is our H2 and P-tag. So we have to go to the Flex option of doing it. And in here, there's a bunch of them, I just scroll down to the little icon. Well, the little example matches what I want. That's the one I want. And I'm assuming it's this, so 'd-flex, align-items-center', nice. 

So we don't have to do the Display Flex because that is, all kind of like wrapped up in this Class here called D Flex. And we remember that Align Item Center from earlier on. It's going to partially work. Let's have a look. They're all centered but these guys get squished, because Flex, remember, tries to line them up side by side. Way to get around that is put them on their own little wrapper. So these guys here, remember, Flexbox wants to put them side by side. So if we put them into one Div, we wrap them up in a single Div, it's kind of protected from the parent, because it will be two stages deep. 

So wrapping these all up in their own P-tag. So 'Command-Shift-P' on a Mac, 'Ctrl-Shift-P' on a PC. We're going to type 'wrap', and find 'wrap with abbreviation', and we're going to put-- we could make a Class, but we're just going to use that Section tag, because I don't need to style it at all. I'm just going to use Section, it's a nice kind of like throwaway. You got to actually hit 'Enter' on that, otherwise it doesn't work. Let's try it one more time, I'll get the editor to speed this bit up. Actually, hit center, oh, I hit 'Return'. Now because they're in a nice little protective wrapper this should work. All right, let's get on to the next video.