Evenly Spaced Div Tags
All right, you're back on back in this video. We're going to talk about spacing in between our little boxes down here. Super easy using flex box, the cheat is just add that and you're all the way to the parent. But let's talk about it a little bit more in the video so that we really understand it. Plus hang around, there's a shortcut sheet at the end. Alright. See you in a sec. Alright. You might have seen this in the last video, but before we can get started, we need to fix a little syntax problem. You might have noticed. I forgot to put these. Okay, the semicolons at the end. And why didn't it break it? It's still working fine. It's because it's the last thing in this list. Okay. So and I said background. It needs the semicolon to know that's finished. Okay, then the same with minimum height needs to know it and then this one gets started, but there's nothing after it, so it's fine. It's not until you go All right. I want to do something with I don't know display, but it just doesn't...
work. It's the wrong color and doesn't pre fill in because I forgot these fellas. All right. That's fine. Got that out of the way. So, what we wanna do right is we want to add some spacing and we'll show you the bad way and then the really easy way. Okay, because we could just go through because we need to make the box is a little smaller because there's no room at the moment for spacing. So we could just go in here now. And so actually let's make this, let's just make it 30 for all of these. Now. I'm going to use my multi cursor. Have I done multi cursor yet? I think I have. I did anyway, if we haven't Okay, you can hold down the tarmac. It's the option key on a on a pc. It's the whole turkey. Okay? And you can click once, twice three times. See my cursor is flashing all of them. I think we did a slightly different way if you are not sure of the shortcut or it's not working for you. It's this one here. It is but it is there, it's you can switch between command click for multi cursor or there's another option which is also click so you can toggle between those two. Just work out which one works for you and then we'll go to your handy dandy shortcut pdf that we gave you remember that. So 7.30. Nice save all preview. Now we've got some spaces all over here so we want to put it in between and we could do this, we could go margin. So the first one is gonna have a bit of margin on the right and let's say we want it to be 20 pixels awesome. So that's there. And then this one I want 20 pixels on the right of this one as well. Come here, you, you awesome. And then on this one you're like I asked too much so let's increase this one up a little bit until we get it to the edge. And you end up the biggest problem is we're mixing percentages with physical sizes. So the really easy thing to do is delete this another one of the perks of flex box. We're gonna learn lots of perks of flex box. Get rid of, we need the wits. Okay, all we need to do to the parent is say actually I'd like you to justify justify content. Okay. And I want it to be there's lots of different ones. We're going to use space now there's two that you'll use space around in between. Okay, I'm going to do, let's do around and then put it in a semi colon. Okay so all the Children are going to space out nicely. Let's have a little look cool. So it's put space either side. Okay so there's this they both have equal amounts either side. They kind of double up in the middle because he's being they're both kind of connecting together. The other way you can do it is the other one. So we did space around and the other one is called space between. Okay save it and that's the one I want I think you go. So it just separates the mountain nicely. Thanks fixed box. And if you're like, oh this flex box stuff. I'm never gonna remember that as well because I do that. I'm like does it justify content? There's there's another one called justify items. I think anyway, what I've done is I've given you in your exercise files in your shortcut sheet. This thing called flex box sheet by johnny trifle. That'll do this is really cool. Really pretty as well. Good work. And it's quite long. You might wanna print it off, you might want to just look at it like this and it just gives me kind of some basic understanding of them and you can see here to activate the powers of flex box. The container needs to have display flex on it. Okay? And then the Children, let's say this one here, that's the one we wanted was what do we do? We did justify content space around space between go right to the edges. So it's got a nice little visuals of it which I find are super useful and you can just go through and just kind of we're gonna cover lots more of this in the course. Okay, But we'll refer back to this one. Thanks for this journey. All right, that's it for this one. We've done our spacing. Let's get into the next video