Creating a First Web Site with Dreamweaver CS4
Illustration by John Hersey

Creating a Cascading Style Sheet and applying it to multiple pages


From:

Creating a First Web Site with Dreamweaver CS4

with Paul Trani

Video: Creating a Cascading Style Sheet and applying it to multiple pages

The power of CSS not only lies in the control it gives you over the design but the fact that you have the style separate from the content, and this separation really gives us flexibility to apply the style across multiple pages. So currently as you can see, this index page has a style applied to it, and it's looking pretty good, as opposed to some of these other pages, the about.html, contact, even the portfolio pages. These other pages if you look in the CSS Styles panel, I don't have any sort of styles, any rules applied to them, and what I want to do is I want these other pages to look more like the index page.

Start your free trial now, and begin learning software, business and creative skills—anytime, anywhere—with video instruction from recognized industry experts.

Start Your Free Trial Now
please wait ...
Watch the Online Video Course Creating a First Web Site with Dreamweaver CS4
2h 41m Beginner Sep 16, 2009

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.

Topics include:
  • 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
Subject:
Web
Software:
Dreamweaver
Author:
Paul Trani

Creating a Cascading Style Sheet and applying it to multiple pages

The power of CSS not only lies in the control it gives you over the design but the fact that you have the style separate from the content, and this separation really gives us flexibility to apply the style across multiple pages. So currently as you can see, this index page has a style applied to it, and it's looking pretty good, as opposed to some of these other pages, the about.html, contact, even the portfolio pages. These other pages if you look in the CSS Styles panel, I don't have any sort of styles, any rules applied to them, and what I want to do is I want these other pages to look more like the index page.

So, if you will notice, for this index page, I have all of these various CSS rules, and really I want to take these and I want to separate this into its own file, all of these rules and I want to apply that file to the other pages. So, all I need to do is select all of these rules. So I've just Shift+Selected all of the rules and I'm going to do a right-click or Control-click if you are on a Mac, and I want to move all of these rules.

I'm going to move all of these rules to an external style sheet. I'm going to select a new style sheet. This is what I want to create. I'm going to select OK and I'm going to go ahead and put it in my CSS folder in here. I am going to give it a name of janedoe. So, it's going in the CSS folder. It's called janedoe.css, because it's going to sort of define the style for this entire site. I'm going to click Save, and sure enough this page doesn't look any different, which is exactly what I want to happen.

But if you look in CSS Styles panel, it now says janedoe.css and all of the individual rules are located in this CSS file. In fact, I even have a quick link. Using this File Navigator bar, I can jump to that CSS as well. So again, it's easy to access that CSS file. But it's still connected to my Source Code or to this current page. So, now that that's separated out, it's in that janedoe.css file.

I can take this CSS file and I can apply it to the other pages. So, I'm going to go to the about.html page, and it's really quite easy because all I need to do is go to my CSS Styles panel, and I'm going to link by clicking on this Chain-link icon. I'm going to attach this style sheet that I just had created to this about.html page. So, I can type in a URL, I'm going to actually click Browse instead of typing any URL, but I can go ahead and go in my CSS folder and locate the janedoe.css file I just made.

So, I have it selected, click and Choose, and it's just going to link that CSS and that's what I want to do. I don't want to import all of that content, I want to link to that file. I can also choose the Media type. So, this is just to get you familiar with some of the other options. I could have a CSS layout for print, for a handheld, so you can have a lot of flexibility here and you can have sort of multiple CSS pages associated with sort of one page if you wanted to.

But really I'm building this for the common web browser on sort of a common computer system, so I'm choosing screen. Let's select OK, and let's see what happens. There we are. Sure enough, it applies that style, and it's looking pretty darn good. In fact, if I look in my CSS Styles panel, you can see here is my janedoe.css. I then twirl down and I can see all the CSS styles are in there. One issue you might notice is that this content isn't in a box, like I'd really want it to be, and in general, I don't have to necessarily draw a new absolute position to div.

I need to define it as a division of content and I need to apply this content style to it. So, I have selected all this text, and I'm going to go to my Layout tab and I'm going to make sure I'm in this Classic workspace mode, and I'm going to select this first button. I'm going to insert a div tag. So, this is a division of content that I'm defining. So, I'm going to make sure this div is wrapped around all of this content and I want to give it an ID of content, because that's what is in my CSS Styles panel.

So, I have given an ID of content, I'm going to select OK, and there you are. It defines this page and it gives me that division of all of that content. I want to do that across the board because I want to go to the contact page and really it's the same process. It's attaching a style sheet, browsing to that specific style sheet, again, it's in the CSS folder, click Choose, change my Media type, which technically isn't necessary, but it's a good practice. Select OK.

It applies that style and again the same process of selecting the content and then wrapping it, sort of defining it as its own area and making sure the content CSS rule is applied to that area. So, it's coming along nicely. The last section is the portfolio section. So again, attach my style sheet, browse to it, janedoe.css, click Choose, change my Media type to screen, select OK, and wrap in a content.

And making sure it applies the content CSS rule. Just like that. So, here we have four pages. They all finally look like a complete site and sort of are all associated to this one janedoe.css. In fact, if I come in here and I change the h2 rule, for instance, and what I want to do I want to maybe italicize the text. So, I'm going to click Apply, and it italicized this text.

I just need to change it in this one place and if I go to these other pages, I can see that text is italicized. So not only do you have a lot of control over your design, but you can easily change your design in one location, and it will change all of the pages that are associated with that CSS file.

Find answers to the most frequently asked questions about Creating a First Web Site with Dreamweaver CS4 .


Expand all | Collapse all
please wait ...
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.
 
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

* Estimated file size

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 ?

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 preferences from 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.

Learn more, save more. Upgrade today!

Get our Annual Premium Membership at our best savings yet.

Upgrade to our Annual Premium Membership today and get even more value from your lynda.com subscription:

“In a way, I feel like you are rooting for me. Like you are really invested in my experience, and want me to get as much out of these courses as possible this is the best place to start on your journey to learning new material.”— Nadine H.

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.