Using Diy Tags
Hi there. This video we're going to build a yellow box and then a pink box. We'll try to at least we're going to learn to do it using something called a div tag. It's a division of space and it gives us the kind of boxes that we get to put our website inside of. Alright, let's jump in and learn it. Alright to get started. Let's close down the other documents we've been working on. We're not going to use those again. We're going to create a new one just to kind of separate everything and all our different bits of learning. So file new file. Let's save it. Let's call this one Div tags dot html. Don't forget the html. Okay. And we're going to add all of that head tag goodness by putting exclamation mark hitting return. Okay. Put all that junk in. We make sure we update the title Div tags we put in the description, but we're not at the moment because it's kind of like a throwaway project just to learn what division or the div tag is. So the diV tag goes on the body because I want people to...
see it and what do we want it to look like um in your exercise files. Okay. There's a folder called wire frames and This one here called HTML Div one. Okay. I'm going to open that for no reason. We're just I don't know. I drew it out my notebook so I figured I'd show it to you this is what I do when I'm wire framing. Okay. So it's not a particularly good or exciting wireframe, right, we want a yellow box and we want to kind of a pinky box underneath. So first box. Second box, that's what we're going to make. So to add it, we add a tag called div. So I'm going to make some space in here in my body. I'm gonna tab across for no good reason other than it looks nice and we're gonna put in a div tag. So DiV tag starts with angle brackets, give close angle brackets and it's very clever and puts in the closing of that tag and everything inside of this is going to be my square. Let's preview what we've made so far. So let's save it, go to google chrome. It's gonna file. Let's go to open, where is this new, new, new, new open file. There's my new div tag click open and I got the title but there's nothing appearing on the page. So a diV tag without any CSS is invisible, it's there, but we haven't styled it. So what we need to do is tell it to do some stuff like the yellow and give it a size. So we do that with our CSS we'll do it in the head tag. Remember before the head closes, I'm gonna type in. Do you remember what goes up the top of your, you remember style? Okay. Style. Okay. And close it off. Put a return in. I'm gonna put all my styles in here. I'm gonna tab in just because it looks nice. I'm just using my tab key and what we do. So we need to style the div remember we had a church one before. Okay so we're gonna style this div and what goes next curly braces. Perfect then let's style it. Let's give it a color. Now when you're styling text it's always just referred to as color. When you're trying to do a background color, you have to go the full background There it is there you can see background color, what color we're going to use. I'm going to put in yellow. Okay. Remember what goes to the end semi colon. Save it. Let's preview it in the browser and okay. Nothing appears because at the moment this div tag is yellow but it has no dimensions. It either needs a height or it needs some stuff in it. So inside this div tab across stuff in it. Okay if I do that, save it, go back to my browser now at least now with some text in it, it kind of forces that div tag open a little smudgy bit so I can see it now it doesn't know how big it is it's just showing me enough to squeeze the text in and it's kind of spilling across so let's give it a height and a width and in here let's just put in a P. Tag. Okay rather than just plain old text so we're gonna put in some body text paragraph for P. And let's just put in first box. Save it and let's style it. So up here. Okay the div tag is yellow. We're gonna put a return afterwards and let's give it a width and a height. So with I'm going to give it what did our little style sheet say? 600 x 400. Okay so we're going to go 600 pixels for the width member has to have peaks and you have to have the semi colon and the height. Okay. The same it was 400. Right 400. I wrote it down. Come on. All right now we've saved this. Let's jump into my google chrome refresh. Hey so that is my structure. Okay. That's a that could be your navigation. Pretty big navigation but that could be the middle of your website or your footer. It's a nice big cube that we can start putting things like H. One or P tags in Koha. So a lot of your basically your site is made up of structural bits, these div tags and text elements and images that go into it and videos. Okay. But the dog tags of the structure. Now what we want to do is we want to put in the second box down the bottom here so in V. S. Code. I'm going to down here make a second Div let's just copy the first one. Let's save some time copy when you have your copying. Make sure you grab the opening and the close, it's easy to know where the closing is. If you click on it kind of highlights it here. Just have your cursor flashing in like the head here, there is the closing. So I've got to make sure I grab all of that copy it. So I'm just using edit copy and paste it in. Okay, the tabbing is a bit weird and because of the O. C. D. About this, I'm going to make it all look nice. And so the first box in second box. 2nd box. Save it. Let's preview in a browser preview. We got a second box. Hey, okay. And the last thing we want to do is we want to make it a color, We want to make it this pink. Okay. So envious code, we're gonna go up here and this is where we run into our first problem. We're styling this thing called tag in. Html. Tag this div. The problem with it is that this Div appears twice but we can only color it once. So we're going to learn in the next video what something called a CSS class is and allows us to individually attack this first box rather than the second box. Okay. And style them differently. But for the moment we've put in our Div tag, it's awesome. Now we need two different kinds of gift tags that have different sizes and different colors and we'll learn how to do that with a CSS class and the very next video.