Creating a CSS-based layout
Video: Creating a CSS-based layoutThe 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.
Viewers: in countries Watching now:
Creating a First Web Site with Dreamweaver CS4 shows the basics of doing just that—building a first web site. Adobe Certified Instructor Paul Trani walks through the important steps of creating a web site from concept to publishing, using Dreamweaver CS4. He teaches how to create basic web pages, add text and image content, use Cascading Style Sheets for design and layout, create a photo gallery, and even check the final site for browser compatibility. He also demonstrates how to create a contact form to encourage viewer feedback on the site. Exercise files accompany the course.
- Exploring the Dreamweaver workspace for first-time users
- Linking to external web pages and sites
- Improving the presentation of text and images on the site
- Building a layout using Cascading Style Sheets
- Making navigation reusable across multiple pages
- Displaying content using the Accordion widget
- Creating a contact form and sending data from it
- Making the final site search engine-friendly
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.
Find answers to the most frequently asked questions about Creating a First Web Site with Dreamweaver CS4 .
Here are the FAQs that matched your search "" :
- Q: After creating the website as instructed in the tutorial, and uploading the site to the internet, the website does not seem to work for every browser. How can one make sure that the website will work for all browsers?
- A: An important step when creating a website is to check for browser compatibility. To do so in Dreamweaver, go to Window > Results > Browser Compatibility. Click the Play icon in the left corner then go to Settings and target the browsers you¹re after. Then hit the Play button to run it and check the page that’s open. If there’s an issue, best-case scenario, it should show you what the issue is and link out to a solution. Worst case is that it’s a pretty unique issue, in which case further troubleshooting would be needed.
- Q: The background image is tiling, instead of being one large image. How is this corrected in Dreamweaver?
- A: This can be corrected by using a larger image, something around 1024x768 that will fill up most of the monitor space. The issue is that the background image is just too small. Note that tiling of the background image can be turned off in the CSS Panel, but that would only result in a single small image. So it’s better to just use a larger image for the background.
- Q: When trying to import SWF content, I get a message: “This file is outside the root folder of site ‘xxxxx’ and may not be accessible when you publish the site.” What is causing this?
- A: Make sure your SWF file (and all files you put on a page) are located in your local site. Basically make sure you set up a local site in the site panel. It will ask where to put your local site on your computer. Just make sure you SWF is in that folder and you won’t get that error.
Sorry, there are no matches for your search "" —to search again, type in another word or phrase and click search.