Easy-to-follow video tutorials help you learn software, creative, and business skills.Become a member

Creating a CSS-based layout

From: Creating a First Web Site with Dreamweaver CS4

Video: Creating a CSS-based layout

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.

Creating a CSS-based layout

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.

Show transcript

This video is part of

Image for Creating a First Web Site with Dreamweaver CS4
Creating a First Web Site with Dreamweaver CS4

32 video lessons · 51556 viewers

Paul Trani
Author

 

Start learning today

Get unlimited access to all courses for just $25/month.

Become a member
Sometimes @lynda teaches me how to use a program and sometimes Lynda.com changes my life forever. @JosefShutter
@lynda lynda.com is an absolute life saver when it comes to learning todays software. Definitely recommend it! #higherlearning @Michael_Caraway
@lynda The best thing online! Your database of courses is great! To the mark and very helpful. Thanks! @ru22more
Got to create something yesterday I never thought I could do. #thanks @lynda @Ngventurella
I really do love @lynda as a learning platform. Never stop learning and developing, it’s probably our greatest gift as a species! @soundslikedavid
@lynda just subscribed to lynda.com all I can say its brilliant join now trust me @ButchSamurai
@lynda is an awesome resource. The membership is priceless if you take advantage of it. @diabetic_techie
One of the best decision I made this year. Buy a 1yr subscription to @lynda @cybercaptive
guys lynda.com (@lynda) is the best. So far I’ve learned Java, principles of OO programming, and now learning about MS project @lucasmitchell
Signed back up to @lynda dot com. I’ve missed it!! Proper geeking out right now! #timetolearn #geek @JayGodbold
Share a link to this course

What are exercise files?

Exercise files are the same files the author uses in the course. Save time by downloading the author's files instead of setting up your own files, and learn by following along with the instructor.

Can I take this course without the exercise files?

Yes! If you decide you would like the exercise files later, you can upgrade to a premium account any time.

Become a member Download sample files See plans and pricing

Please wait... please wait ...
Upgrade to get access to exercise files.

Exercise files video

How to use exercise files.

Learn by watching, listening, and doing, Exercise files are the same files the author uses in the course, so you can download them and follow along Premium memberships include access to all exercise files in the library.


Exercise files

Exercise files video

How to use exercise files.

For additional information on downloading and using exercise files, watch our instructional video or read the instructions in the FAQ.

This course includes free exercise files, so you can practice while you watch the course. To access all the exercise files in our library, become a Premium Member.

Join now "Already a member? Log in

Are you sure you want to mark all the videos in this course as unwatched?

This will not affect your course history, your reports, or your certificates of completion for this course.


Mark all as unwatched Cancel

Congratulations

You have completed Creating a First Web Site with Dreamweaver CS4.

Return to your organization's learning portal to continue training, or close this page.


OK
Become a member to add this course to a playlist

Join today and get unlimited access to the entire library of video courses—and create as many playlists as you like.

Get started

Already a member?

Become a member to like this course.

Join today and get unlimited access to the entire library of video courses.

Get started

Already a member?

Exercise files

Learn by watching, listening, and doing! Exercise files are the same files the author uses in the course, so you can download them and follow along. Exercise files are available with all Premium memberships. Learn more

Get started

Already a Premium member?

Exercise files video

How to use exercise files.

Ask a question

Thanks for contacting us.
You’ll hear from our Customer Service team within 24 hours.

Please enter the text shown below:

The classic layout automatically defaults to the latest Flash Player.

To choose a different player, hold the cursor over your name at the top right of any lynda.com page and choose Site preferencesfrom the dropdown menu.

Continue to classic layout Stay on new layout
Exercise files

Access exercise files from a button right under the course name.

Mark videos as unwatched

Remove icons showing you already watched videos if you want to start over.

Control your viewing experience

Make the video wide, narrow, full-screen, or pop the player out of the page into its own window.

Interactive transcripts

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.

Are you sure you want to delete this note?

No

Your file was successfully uploaded.

Thanks for signing up.

We’ll send you a confirmation email shortly.


Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

Keep up with news, tips, and latest courses with emails from lynda.com.

Sign up and receive emails about lynda.com and our online training library:

Here’s our privacy policy with more details about how we handle your information.

   
submit Lightbox submit clicked
Terms and conditions of use

We've updated our terms and conditions (now called terms of service).Go
Review and accept our updated terms of service.