🚨 Heads up! This course is no longer supported. We recommend checking out our Webflow Essentials course.
How to add padding to a DIV
Questions
Student Gallery
Be the first to share something.
Course info
Overview
- You'll need a laptop (Mac or PC)
- Dreamweaver CC installed. Dreamweaver can be downloaded from theAdobe website here.
Can I use this tutorial with Adobe Dreamweaver CS4, CS5 or CS6?
Daniel Scott
Founder of Bring Your Own Laptop & Chief 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.
Downloads & Exercise files
Transcript
We're gonna use the text div tag. In this case, I'm gonna down my breadcrumbs click text. Okay, so it's selected. You can see it's selected here in my selectors panel. And I'd like to scroll down in the properties panel until we find padding. Okay, so what I'd like to do is I'd like to add 40 pixels.
So I've just typed in 40 and hit enter. And on the left and on the right hand side I'd like to enter 20 and hit enter. You can see it's added the padding. You can see this kind of, uh, if I click the div tag down here, the frosty stuff on the left and the frosty stuff on the right means it's 40 on left, 20 on the right. The problem with it though is that it's pushed its neighbor down, which was our image div tag. It's pushed it below it because there's not enough room.
Now it's basically expanded the box by an extra 60 pixels. So what we have to do when we're adding padding, it's a bit weird that Dreamweaver doesn't know that you want to, um, substitute padding for the size. So it's 70, um, 700 pixels wide, plus the padding. So when we need to do is go and find the width of this box. So make sure you've selected text in the text of tag down the breadcrumbs and instead of it being 700, okay, I want it now to be what, six 40 And okay, so six 40 plus the padding equals 700. So whenever you add padding to any boxes, you may have to go and remove it off the width.
Okay. In terms of the height, this case wouldn't matter because we have no height set. You can see height set to auto, which means it'll expand and contract depending on what's in the box. So if we add a padding to the top or the bottom, it wouldn't matter. Great. Let's do it one more time.
Let's do it for the footer down here. Okay. So you can see the copyright is sitting right next to the edge. So I'd like it to push over the exact same. I'd like to push over, uh, 40 pixels. So I'm clicking inside the footer.
I'm gonna click the diviv footer in the breadcrumbs and I'm gonna slide down on my properties panel. And the padding here is going to be 40. Okay. And you can see it hasn't really made any difference 'cause the foot is at the end. Uh, it's our last div tag inside the container. So it's not gonna really cause us like that many problems 'cause nothing afterwards.
But you can kind of see in the right hand side here, it's pushed itself over 40 pixels. So let's do it properly. Let's minus the 40 pixels off this 1024. Okay. So that gets us down to nine hundred, nine hundred and eighty four. Alright, great.
So that's how you add padding to a div tag so that you can get things to line up. Alright, that's of the tutorial. See you in the next one.