This lesson is exclusive to members

Responsive Web Design Essentials - HTML5 CSS3 Bootstrap

Finishing up our cards

Daniel Walter Scott

Download Exercise Files Download Completed Files



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.


I recommend hosting your new website with Bluehost, you can get a big discount by signing up with this link:

You need to be a member to view comments.

Join today. Cancel any time.

Sign Up
In all honesty, this video is not super exciting. We're going to add the H2s down here, we're going to add our P-tags, and do a bit of styling. It is the meat and potatoes of the course, the doing, we know how to do it, I'm going to throw in some tips and tricks. We'll do some fun stuff with margins, but when I say fun, I mean, worth watching is what I mean. So we're going to add these, let's jump into it. I haven't really sold it but it's the truth. There's no Eureka moments in this one, it's just getting stuff done video. 

So in this video we're going to add an H2 and a P-tag to all of our boxes. And why an H2? Couple of reasons. One is that it's visually, going to be smaller, like Heading1 is our most important, and these aren't as important to the kind of overall importance of the website, because it's not essential, but it is more important to give your H1 all the power it can by not diluting it. If you end up having like 10 H1s on your Home page, it becomes hard for the search engines to know what your site is all about. So keep it to one or two. And these guys are going to be H2s, you've got H2s, 3, 4, 5, 6s. So you can kind of spread it all out. 

So let's add them. I haven't got a copy because it's just Book Online. We could type that, so let's stick it in, let's go to Card1, I'll put a Return in, I'm going to do an H2, and this one is going to be Book Online. Save it, let's have a little look. Always test as we go through. And this is just going to be a P-tag. We're going to put in some basic Lorem Ipsum, and 15 words, it's kind of what I worked out, it's going to be nice. Let's have a look, that will work fine. 

So let's style this H2, so in my CSS-- I just keep them together, there's no reason why the H2 has to be above the P-tag, but it's just nice when you're searching through it to find all the Hs together. It's cheap, I'll grab all the H1 stuff, and just play around with the size. Now I've already worked out my sizes Remember my crazy ratio, the times 0.0625, 'x0.0625'. It's going to be two rems for the size that I want. I want it to be Playfair, and margin, I haven't decided on. So I'm going to delete that. Let's have a little look. 

So there's my H2, my P-tag. At the moment it's using everything I've done currently for the P, but in my case I want them to actually be smaller. Can you see my design here, this text is a lot smaller than this P-tag. So I start with the generic P-tag. I want to change this one, we're going to use a Compound Selector. So we've looked at these before, so what I want to say is, if there is-- we could-- depends on how specific you want to be. You could say, I want it to be in Card1, if there's a P-tag, do this thing, but because it's going to be in all of the cards what I'm going to say is, I'm going to use this one, so I'm going to say, that kind of wrapper that I used around the outside. 

So I can say, if there's a P-tag anywhere inside of all of that giant Div tag, which opens there and closes there, which includes Cards 1, 2 ,& 3, it should work. So what I want to, I worked out that I want the font size to be about 0.85. Save it, let's have a little look. Not working, save it, check it, still not working. Do you know why? I don't know why. I'm going to pause it and figure it out, and I'll be back. A-ha. You all saw it, okay. Ah, learning. So I forgot to put in rem, and the semicolon, like, just left half this syntax off. Phew, easy one. 

Now we're going to have to fight with the Line Height, because we set it up here to be perfect but now it's not quite working. So we're going to use Line Height, of just anything bigger than 0.85. I've already worked mine out, at 1.2. Now I want to center this and this. So what I could do is I could say, I want you to be Text-align:center, but I'd have to do it twice. I'd have to do it for you to work, oh, for you to work. Copy it, Daniel, you can do it, and then paste it here, and that would work fine, totally, but let's just be clever and not have it on these, and have it on the wrapper, on the outside. 

So we're going to say, everything in the cards is going to be Text-align:center. Let's have a look now, does the same job. The cool thing about it is it's going to do it for this, this, and in the upcoming video, when we add the icon it will be center as well. So just a bit more clever. Couple of other things I want to do, is I need-- it's going too close to the edges, plus the Padding above it, and all that sort of stuff. So let's add some Padding, and I want to show you a cool little shortcut thing. 

So up until now we've been doing this. So we want some padding above, below, left and right So you can see, I want some Padding above, left and right, and below. And that can be painful when you're doing, "Okay, I want some Padding or Margin," in this case it doesn't matter. So I'm going to do Margin Top, and then you do that, and you do the bottom, left, right, and you've got lots of lines. So what you normally do, now that we're all getting a bit further in this, is we just type in 'Margin', and there's some shorthand. 

So basically it starts at the top. Let's say we want it to be 10 at the top, I use 10 pixels, no comma, that's the top, you just put a space in, and you want 30 on the right. I'd like it to be 20 at the bottom, and then 30 on the left. So it always works that way around, so top, and then it goes around clockwise. So the top, right, bottom, left, that makes sense? Clockwise. Let's save it, let's have a look. And it's added the 10 at the top, 30 there, 20 at the bottom, and 30 there. 20 at the bottom doesn't make any sense at the moment. Later on in the course when we add the icon above it, it kind of pushes. It's just some space underneath it, so that it doesn't kind of sit right down the bottom here. 

So that's some cool little shorthand, let's say that-- lets say we want 20, because at the moment we have 10 on the top, and 20 on the bottom. Let's just say, we didn't care, like it's really common to do just the same at the top. So I want 20 at the top, and the bottom, and I want 30 on the left and the right. So you can get even more shorthand-ry. If I do 20 and 30, and only have two measurements, it assumes you mean top and bottom, left and right. Does that make sense, kind of? 

You can just type in Margin bottom, top, left, and have four lines, but this is the super shorthand version. I couldn't use that, because I wanted the top different from the bottom. 20px, and then 30 again. We're going to add a little bit of Padding on the H2 as well, because I want it, not just to be off the top of this box, but it's going to be of the icon that we're going to add later on. So we're going to go-- so, this case, it's perfect for Margin Top, because we don't have any other measurements that we want to add. We're at 20 pixels. 

Why am I using pixels and not rems, that's a good question, because sometimes people can-- you can use rems for sizes like this as well, but I find, like I can't see the reason to have rems, that if somebody scales up their font, the spacing from the top needs to change. I don't think it needs to. Doesn't really matter if this font gets bigger, it can still stay 20 pixels from the top. So I find things like spacing, I'll leave as pixels, absolute font sizes, and for things like font, actual font measurements, it's what’s called a relative size. So it is, one rem is relative to whatever the default size is set to the browser. Relative, absolute. 

Let's add it to these other boxes, and then we'll move on. So I am going to grab all of this. You guys, copy, paste it in there. I'm going to paste it in here. And I was going to change, what have we got? Service types, thank you very much. The last one, oh geez, come on. I'll use shortcuts, 'Call for Advice'. It's going to be the last one, so you just have to type these in. Here we go in our H2s. So it should be in all three of them, let's have a little look. Nice. 

All right, that will be it for this video, The next video, we're going to make the whole thing clickable, which is kind of cool. All right, cards coming along. I'll see you in the next video.