Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member
The layout of a web page is really essential to the design and it's important that we have exact control. And with CSS luckily we have this control. So for instance, what I want to do with this page is I don't really want to have my copy and my content floating on the left side here. I want to create a box in the center that has a dark background and I want to put the content in that box, and I'm going to do this using CSS. Again, the great thing is Dreamweaver makes this all really easy for me.
So I'm going to go up and keep in mind I do have this set to Classic View and you will notice in this Application bar I can go to Layout. So I'm selecting the Layout tab and in there, there are different options for the Layout. In fact, I can insert a div tag. That's one option and I can also draw an AP div, which is what I want to do. So I want to draw an absolute positioned division of content.
This is what I'm doing. I'm going to create an AP div. I'm going to draw one. When I have that selected, it's going to give me those crosshairs and I can just click and drag to create this big box. So there is my box. It's an absolute positioned div. In fact, I can select any edge of this and move this box around to where I want it and really I'll just keep it in the center right there. But really I want to have all this content in this box, so I can just go ahead and click and drag to select all of the text.
And then click and drag it into that box that I have just created, this AP div. That's looking better so far. And again, I can grab sort of from this upper left-hand corner. It's usually what I do is position this wherever I want it to. But what I can also do with this AP div selected, I can go down to my Properties panel. This gives me absolute control and that's exactly what I want. I'm going to start on the left-hand side because I really want to give it a more specific name as opposed to apDiv1.
I want to call this just Content because this holds the content for this page. Next up, I want to maybe change the Width of this div. I'm going to change the Width to 700 pixels. So that's looking better. The Height, I can go ahead and leave alone. But since I'm talking about the layout, I would like to bring up sort of the Width of items and really I don't want the Width to go over say 1,000 pixels. In fact, if I have it around 700, I'm going to be able to print out this page without an issue. So 700 pixels.
That's kind of how I arrived at that number. But you can see I can change the Width. I can change the Height. I can change the position, sort of the left and top. Again, if I move it around, you can see those numbers change. But again, I want more control than what this Properties panel gives me. What I can do is go over to my CSS Styles panel and you will notice right down at the bottom there is this content CSS style that has been added to the list. So again, I can just double-click on content and it gives me the CSS rule definition for this item.
So from here, again more control. So I can go down to say the Background for instance and definitely if I move this out of the way, you can see that it's kind of tough to read that text. So what I want to do, I'm going to go beyond sort of adding a color back there. I want to add an image in the background. It's kind of a semi-transparent image. So in order to do that, I'm going to click Browse and in the Images folder I'm going to locate this bkgd.png. So this PNG file is just a graphics file that has semi-transparency applied to it and then a little design in the upper left-hand corner.
So I'm going to choose that bkgd.png and again I'm given more control in here if I want it, but really I want to leave that as a default. But I'm going to go ahead and click Apply. Sure enough you can see it and it's so much better. I'm finally able to read that text. I can see that little design that's in the PNG file, which is a nice little accent design up there. And again, I can kind of move on to manipulating this some more. Because another issue I have with this is the fact that there is no padding.
So there is no padding between say for instance the edge of this box in the text. So I want to give this padding. So let's go down to Box. And if I select Box in this category list here, you will notice Padding is right in here. So let me go ahead and give it some padding. Make sure Same for All is selected. But I'm just going to type in 20 and then I'm going to click Apply. Even better, it gives me 20 pixels around sort of all the edges. Next up, what I want to do is I want to go ahead and change the border.
I want give this just a black border just to give it a nice crisp edge. And I can do that in here, select Border, I'm going to go ahead and determine the type of border. So the Style is going to be solid and the Width is going to be about 3 pixels, so I'm just going to type that in. Then I'm going to change the Color to black but just so you can see it, I can change it to red and you will see that red appear. But again I want to change it to black. You can see that it's pretty subtle, but there is a hard sort of black edge around it as well. Lastly, I'm going to just go down to Positioning.
Now again, I have already adjusted the Width. The Height is going to be determined by content. So I don't want to really control it here. If there is more content, I want to make sure that this box actually will expand to fit more of that content, but what I want to do is just delete the Height altogether. Now it's going to be a variable height depending on the content. So I'm going to click Apply. And now I can go ahead and move on to select OK. So let me just go ahead and save this page and let's preview this in a browser as our last step. There it is.
Sure enough I can go ahead and expand the browser, sort of decrease the size of the browser. And again, since this is absolutely positioned, it's an AP div, it will always stay in that location. If I scroll down, you can see that this height is only going to be the height of the content and no more. So as you can see, I'm really given a lot of control when it comes to my layout using an AP div in Dreamweaver.
Get unlimited access to all courses for just $25/month.Become a member
82 Video lessons · 103078 Viewers
58 Video lessons · 55524 Viewers
61 Video lessons · 89720 Viewers
56 Video lessons · 104931 Viewers
Access exercise files from a button right under the course name.
Search within course videos and transcripts, and jump right to the results.
Remove icons showing you already watched videos if you want to start over.
Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.
Click on text in the transcript to jump to that spot in the video. As the video plays, the relevant spot in the transcript will be highlighted.
Your file was successfully uploaded.