How to nested divs inside of each other in HTML & CSS

This lesson is exclusive to members

Course contents
SECTION: 4
Project 2: Bike Repair Website 6:12:48
SECTION: 6
Project 4: Bootstrap Yogurt Website 3:35:39

Questions

1
2
1
1
1
2
2
3

Course info

128 lessons / 17 hours 5 projects Certificate of achievement

Overview

Hi there, my name is Daniel Scott and together we’re going to learn how to build professional responsive websites. which look good on mobiles, tablets and desktop screens.

We will build 4 sites together...
  • a simple but elegant restaurant website.
  • a bike repair website. 
  • a responsive portfolio website.
  • a Bootstrap website.  

We cover everything you need to build your first website. From creating your first page through to uploading your website to the internet. We’ll use the world’s most popular (and free) web design tool called Visual Studio Code.

There are exercise files you can download and then work along with me. At the end of each video I have a downloadable version of where we are in the process so that you can compare your project with mine. This will enable you to see easily where you might have a problem.

We will delve into all the good stuff such as how to create your very own mobile burger menu from scratch learning some basic JavaScript and jQuery. 

 You will...
  • Learn how to work with responsive images and icons. and stunning full screen background images and probably one too many gradients. 
  • Learn how to create forms and to choose great fonts for your website. 
  • Learn how to work with Bootstrap 4 to easily add carousels, cards and complex looking menus. 
  • Setup a domain name with hosting so that your website is live on the internet for others to see.  

There are fun class projects for you to work on which will enable you to practice what you learn. By the end of this course you’ll have a great understanding of important web design topics like HTML5, CSS3, Flex box, Responsive design and Bootstrap.   

If that all sounds a little too fancy - don’t worry, this course is aimed at people new to web design and who have never coded before. We’ll start right at the beginning and work our way through step by step. 

Who am I? 

I’m Dan, and I’ve been building websites for about 15 years now. I am award winning instructor, and have won a MAX Master award for the last 2 years in a row at the prestigious Adobe Max conference.

Time to upgrade yourself?
Sign up for the course and let’s learn how to build responsive websites.

Course duration 16 hours 42 mins
Daniel Scott

Daniel Scott

Founder of Bring Your Own Laptop & Chief Instructor

instructor

I discovered the world of design as an art student when I stumbled upon a lab full of green & blue iMac G3’s. My initial curiosity around using the computer to create ‘art’ developed into a full-blown passion, eventually leading me to become a digital designer and founder of Bring Your Own Laptop.

Sharing and teaching are a huge part of who I am. As a certified Adobe instructor, I've had the honor of winning multiple Adobe teaching awards at their annual MAX conference. I see Bring Your Own Laptop as the supportive community I wished for when I was first starting out and intimidated by design. Through teaching, I hope to bring others along for the ride and empower my students to bring their stories, labors of love, and art into the world.
True to my Kiwi roots, I've lived in many places, and currently, I reside in Ireland with my wife and kids.

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.

How to earn your certificate

Work your way towards your certificate for this course by following these simple steps.

  • Watch the course videos
  • Complete the Class Projects - look out for the videos marked with
  • Upload your class projects into the My Projects area in your account
  • Complete and pass the Knowledge Quiz (Merit level courses only)
  • Complete the Distinction Certificate Project (Distinction level courses only) - look out for the video marked with
  • Upload your Distinction project to the My Projects area in your account
  • Request your certificate when you've completed the requirements for the certificate level you're working towards

Good luck!

Pass certificates

We’re awarding ‘Pass’ level certificates for this course.

You can work your way towards your ‘Pass’ certificate by following these simple steps.

  • Watch the course videos
  • Complete the Class Projects - look out for the videos marked with
  • Upload your class projects into the My Projects area in your account
  • Don’t forget to request your certificate when all your projects are complete

Good luck!

Downloads & Exercise files

Transcript

Hi there, this video we're going to talk about Nesting Div Tags. What that means is we're going to end up doing this, where we have our original yellow and pink box, and we put other boxes inside of it. It's called Nesting. It's not that fancy. You can see here, boxes inside of boxes. They end up looking like this, in the end we're going to put, text inside boxes, which are inside of boxes. Yeah, let's do that now, I'll show you in VS code; let's go. 

All right, what we're doing is, in your Wireframes folder, in your Exercise Files, we're looking to make this one here, HTML Div 2. So, same boxes. We'll use the same thing we've created so far. I'm going to put two boxes inside, a gray box and a purple box. Those are the heights, let's work out how to do it. 

So in VS code, we're going to do what's called Nesting. Just means we can put Divs inside of Divs. So we have one Div here, and a second Div. Let's work on that first one, which is going to be our gray, 100 x 300. So where does it go? It depends on where you want it, I guess. We've got this text in here, we don't really want anymore. That was just, I guess--

I put that P-tags in there to show you how we could highlight, and just so the box will have some content in it. Let's delete that for the moment, just to make it nice, and clean, and clear. So what we're going to do is put a Div, say just where that P-tag was. So if we go, angle brackets, div, '<div, Now we're not going to make a Div, then create a Class up here, then come back and name it, we're going to do it all in one go. So instead of just closing it off here now - I'm going to undo that - I'm going to put in 'class', before I finish it. Now I'm going to call this one 'box3', then I'm going to close it off. Just to save some time, rather than coming back and doing it later. 

I'm going to put -- do I put anything in it? No, just going to leave it empty, but remember, this is where it would go inside of that Div. Let's leave it empty. Let's save it, and it's not going to appear yet. 'Refresh', the text has gone, and there are Div tags in there, but I can't see it. So we need to style it. We do not need this anymore, because I got rid of it. I'm going to call this one '.box3', curly braces. And we're going to steal all of that. We're going to pick gray, which is spelt both ways. Wow, I get caught up with that every time. Gray, gray, and gray, I don't know why I find that amazing. It's the same gray, just spelt in different ways. 

This one was a width of 100, and a height of 300. Here we go. Well, 3000. That's not going to work. Let's save it, and let's check it out, let's see if we made it work. 'Refresh', look at that. So often when you're making a website, you'll make kind of like an overall website background, a big container, and inside of that container you'll nest lots of different Div tags. Like the Header, the Navigation, the images, and carousel, and all those things; that's Nesting. 

Let's do it with the second box, and I want to show you just a couple of things, like if you don't get it in the right spot, so let's delete that P-tag from here. That's where it should go a bit, let's say we do it just outside of here. So let's go, angle brackets, Div, space, Class, Return. This one's going to be called 'Box 4'. Close it off with the angle bracket. 'Save'. At the top here I'm going to copy and paste the whole thing; real lazy. 'Box 4', this one was purple. Purple. And it was 120 x 350. Well, it's actually 350 x 120. Height at 120. Let's give it a look, and preview in the browser; awesome. Well, not awesome, it's in the wrong place. 

So if you get it in the wrong place, it's really simple, in the code to go, actually you, 'Cut', and you, 'Paste'. I'm going to line it up, so it looks nice and all aligned. Hit 'Save', and now, 'Refresh', it should be in there; awesome. Now if I want say an H2 inside of that purple text, I could just put it here, there's nothing wrong with typing H2, closing it off, and typing it in here. 'Heading 2'. That's perfectly, grammatically, and syntactically - if that's a word - correct. Let's give it a preview, it's in there. 

What ends up people-- what ends up people doing?! What I like to do to make everything look nice, is put Returns in between all of this, to really expose the nesting, so I know that there's a Body tag. Inside of that is Box 1. Inside of that is Box 3, you can kind of see the indentation. Same with this, Box 2, and inside of that is Box 4, and inside of Box 4 is H2. Does that make sense? 

All right, so we're getting a hang of this Div tag division of space thing, and putting boxes inside of boxes. Let's get on to the next video where we set our class project. Homework time.
  • Powered by Marvin
  • Terms of use
  • Privacy policy
  • © Bring your Own Laptop Ltd 2025