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

CSS drop shadows


Dreamweaver CS4 with CSS Essential Training

with James Williamson

Video: CSS drop shadows

Ah, drop shadows! What would designers be without drop shadows? While it's easy to fake drop shadows by creating images that already have them, what if you would like the freedom to apply drop shadows to any image you want regardless of size? Well, that would be great, and CSS allows us to do just that very thing. Now, as with every CSS based technique, there is always exceptions to the rules. The technique I'm going to show you is but one of multiple drop shadow techniques. For brevity's sake, this technique doesn't use true transparent drop shadows. Rather I have created a drop shadow graphic that blends into the existing background.
Expand all | Collapse all
  1. 7m 50s
    1. Welcome
      1m 18s
    2. Do I need to know CSS to use Dreamweaver?
      2m 15s
    3. Using the exercise files
      1m 30s
    4. Setting up a custom workspace
      2m 47s
  2. 1h 2m
    1. Separating structure from presentation
      4m 14s
    2. Adding meaning with ID and class attributes
      7m 50s
    3. Understanding basic selectors
      11m 10s
    4. Understanding complex selectors
      11m 21s
    5. Examining the Cascade
      10m 16s
    6. Understanding order of inheritance
      5m 2s
    7. Understanding specificity
      5m 43s
    8. Using Dreamweaver to resolve conflicts
      7m 4s
  3. 52m 48s
    1. Working with starter pages
      2m 1s
    2. Defining fixed, elastic, liquid, and hybrid
      6m 3s
    3. Understanding starter page structures
      6m 25s
    4. Modifying CSS globally
      8m 58s
    5. Moving CSS between files
      12m 31s
    6. Preparing custom starter pages
      10m 9s
    7. Creating custom starter pages
      6m 41s
  4. 1h 25m
    1. Designing with CSS in mind
      3m 13s
    2. Using Fireworks to create site prototypes
      2m 41s
    3. Defining page structure
      8m 52s
    4. Creating the initial layout
      10m 24s
    5. Page creation and asset sharing
      11m 20s
    6. Using common libraries to create site prototypes
      5m 11s
    7. Building interactive prototypes
      17m 6s
    8. Optimizing images in Fireworks
      11m 47s
    9. Exporting web graphics from Fireworks CS4
      2m 43s
    10. Exporting interactive prototypes
      3m 11s
    11. When to export XHTML and CSS from Fireworks CS4
      8m 34s
  5. 48m 32s
    1. CSS workflows in Dreamweaver
      1m 17s
    2. Using the CSS Styles panel
      5m 12s
    3. Setting CSS preferences
      9m 50s
    4. Understanding Dreamweaver's CSS visual aides
      3m 50s
    5. The Code Navigator
      6m 5s
    6. Controlling CSS with the Properties Inspector
      8m 52s
    7. Using Related Files
      4m 38s
    8. Working with Live view
      4m 13s
    9. Working with the Reference panel
      4m 35s
  6. 1h 13m
    1. Declaring font families
      4m 57s
    2. Creating custom font family declarations in Dreamweaver
      6m 0s
    3. Understanding units of measurement
      6m 15s
    4. Controlling font sizing
      8m 41s
    5. Controlling line spacing
      7m 20s
    6. Controlling vertical margins
      7m 52s
    7. Horizontally aligning text
      3m 16s
    8. Vertically aligning text
      5m 30s
    9. Vertically centering block-level elements
      10m 31s
    10. Setting column width
      3m 33s
    11. Using font shorthand notation
      9m 15s
  7. 1h 10m
    1. Background properties
      4m 33s
    2. Using background images
      5m 16s
    3. Controlling background image tiling
      5m 33s
    4. Positioning background images
      4m 42s
    5. Using percentage values for positioning
      5m 10s
    6. Creating custom list bullets
      5m 23s
    7. CSS drop shadows
      7m 40s
    8. Image replacement techniques
      7m 24s
    9. Adding screen-only content
      7m 52s
    10. Complex background graphics
      9m 10s
    11. Using CSS Sprites
      8m 0s
  8. 38m 48s
    1. Reviewing table tag structure
      4m 48s
    2. Using thead and tbody for styling
      5m 45s
    3. Styling table captions
      4m 30s
    4. Styling headers
      8m 29s
    5. Styling table content
      4m 18s
    6. Creating alternating row colors
      3m 29s
    7. Using pseudo-class selectors for tables
      2m 27s
    8. Creating custom table borders
      5m 2s
  9. 43m 37s
    1. Examining form structure
      3m 26s
    2. Styling fieldset and legend elements
      7m 42s
    3. Styling form elements globally
      6m 31s
    4. Using classes to identify form elements
      5m 55s
    5. Styling user feedback
      6m 10s
    6. Adding user interaction
      2m 52s
    7. Styling Spry form validation fields
      11m 1s
  10. 44m 49s
    1. Using lists for navigation
      1m 40s
    2. Creating horizontal menus pt. 1: Stripping list styling
      3m 29s
    3. Creating horizontal menus pt. 2: Displaying links horizontally
      3m 54s
    4. Creating horizontal menus pt. 3: Styling links
      5m 25s
    5. Creating horizontal menus pt. 4: Rollovers
      3m 48s
    6. Creating horizontal menus pt. 5: Indicating current page
      3m 48s
    7. Creating horizontal menus pt. 6: Modifying cursor usage
      2m 11s
    8. Creating horizontal menus pt. 7: Positioning menus
      3m 8s
    9. Styling vertical menus pt. 1: Vertical menu considerations
      6m 42s
    10. Styling vertical menus pt. 2: Defining width for link elements
      4m 46s
    11. Styling vertical menus pt. 3: Using background graphics with navigation
      5m 58s
  11. 1h 40m
    1. Box model review
      7m 4s
    2. Understanding margin collapse
      7m 15s
    3. Reviewing normal document flow
      11m 0s
    4. Understanding floating
      8m 56s
    5. Containing and clearing floats
      9m 26s
    6. Understanding relative positioning
      5m 30s
    7. Understanding absolute positioning
      5m 29s
    8. Understanding the AP Elements panel
      11m 57s
    9. Understanding fixed positioning
      2m 24s
    10. Using Dreamweaver to define document structure
      10m 11s
    11. Creating a two-column layout
      17m 1s
    12. Using Dreamweaver's Design-Time style sheets
      3m 49s
  12. 29m 0s
    1. Introducing Spry widgets
      2m 18s
    2. Updating the Spry framework
    3. Examining the default Spry styles
      6m 36s
    4. Modifying tabbed panels through CSS
      5m 19s
    5. Styling Spry widgets
      8m 49s
    6. Organizing Spry style sheets
      5m 13s
  13. 34m 49s
    1. Creating print style sheets
      2m 57s
    2. Assigning media types
      3m 29s
    3. Styling type for print
      9m 21s
    4. Suppressing element printing
      3m 29s
    5. Controlling page breaks
      8m 39s
    6. Using @media blocks
      3m 5s
    7. Creating alternative style sheets
      3m 49s
  14. 35m 22s
    1. Using Dreamweaver's Browser Compatibility Check
      3m 58s
    2. Fixing code errors with Adobe's CSS Advisor
      4m 45s
    3. Strategies for browser compatibility
      5m 8s
    4. Implementing browser compatibility
      8m 18s
    5. Formatting code for deployment
      3m 15s
    6. Creating modular style sheets
      3m 38s
    7. Assembling modular style sheets
      6m 20s
  15. 38s
    1. Goodbye

please wait ...
Watch the Online Video Course Dreamweaver CS4 with CSS Essential Training
12h 7m Intermediate Aug 13, 2009

Viewers: in countries Watching now:

In Dreamweaver CS4 with CSS Essential Training, web developer and Adobe Master Instructor James Williamson teaches the fundamentals of CSS while focusing on how to use Dreamweaver to efficiently create and manage styles. He shows how to use Dreamweaver to resolve style conflicts; how to use new CSS-related features such as Live View; and the best way to create lightweight, site-wide style sheets.

Topics include:
  • Understanding XHTML and CSS fundamentals
  • Understanding and implementing advances in typography
  • Using the Code Navigator for faster CSS edits
  • Styling form elements while maintaining accessibility
  • Customizing the look and functionality of Spry widgets through CSS
  • Controlling layout and positioning through styles
  • Controlling CSS with the Properties Inspector
James Williamson

CSS drop shadows

Ah, drop shadows! What would designers be without drop shadows? While it's easy to fake drop shadows by creating images that already have them, what if you would like the freedom to apply drop shadows to any image you want regardless of size? Well, that would be great, and CSS allows us to do just that very thing. Now, as with every CSS based technique, there is always exceptions to the rules. The technique I'm going to show you is but one of multiple drop shadow techniques. For brevity's sake, this technique doesn't use true transparent drop shadows. Rather I have created a drop shadow graphic that blends into the existing background.

Alpha transparency is doable but requires the use of PNGs and GIFs, and that can get a little tricky in certain browsers. I first saw this technique demonstrated in a tutorial written by Dan Cederholm. Dan assures us that he got it from somebody else, so who really knows who thought of it first. That's really beside the point, because I'm going to show you my particular flavor of it, and because in almost every case you will have to tweak some of the specifics based on your particular design or needs. We will discuss both the base technique here, as well as what was done to tweak it in our particular layout.

Creating drop shadows via CSS requires a little extra work on your part. Each image that needs a drop shadow will be wrapped in a div tag that is assigned a class, and that class will handle all the drop shadow and positioning information for the graphic. The drop shadow graphic itself is going to be a large simple file that contains only the drop shadow. I have got our drop shadow open so that you can take a look at it. In this case, the graphic is around 900 pixels x 900 pixels and it contains a drop shadow that is 4 pixels wide on the right and bottom edges.

And this is important, so I'm going to zoom up on this so you can really see what I'm talking about. This is the top right edge right here. You can see that this drop shadow only lasts for 4 pixels, and on the bottom quarter, it's also 4 pixels that way. The top and left sides don't have any drop shadow applied to them at all, so this is designed to be a bottom right drop shadow, with a little bit offset. So why is this image so big? Well, we want to make sure that the drop shadow is bigger than any graphic that we might be using. That way we'll have plenty of drop shadow to reveal as images get larger.

The drop shadow will be applied to the wrapper div as a background graphic. Then we have to float the wrapper div, and this will call the wrapper to shrink wrap around the image, regardless of image size. Next, you set a position attribute to relative on the image, and move it in a negative direction away from the drop shadow. This will offset it by the width of the drop shadow. Now, if you have never worked with positioning or floating elements, don't worry, there is a whole chapter on layout in this title, but I think you can see how important it is that you understand all of those CSS techniques before you really tackle something like this.

So I'm going to switch back over to Dreamweaver, and I have my 06_07 file open. If you notice, something looks a little odd about my images. Well, more on that in just a moment. But if I click on this top image in the New York City article, I can see using the tag selector that there is a div tag around that with the class of shadow. If I go to my CSS Styles panel, if you browse all the way down to the bottom of your styles, so you can see we already have a class selector of shadow, and it's got a few things in it. For example, the float left that's going ahead and shrink-wrapping that down.

We have a relative position on it. That's going to allow us to move our image round inside of it relative to this. We have got some margins that are keeping elements away from it. Well, we need to go ahead and add our background graphics. So what I'm going to do is double-click on the shadow class, go to my Background property, and I'm going to browse for my background image. Go ahead and browse to the 06_07 folder, and open up the _images directory. What you are going to look for is you are going to look for the drop_shadow.gif. You want to make sure that that's around 900x900 pixels.

Mine says 895, so it's real close. It looks just like a big empty white graphic, although we know that it has that little drop shadow on the bottom right corner. I am going to go ahead and click OK, and where we position this is incredibly important. First off, I'm going to say no-repeat. The next thing I'm going to do is the Background-position (X) is going to be right, the Background- position (Y) is going to be bottom. Now, think about what that's going to do. It's going to take that bottom right hand corner where the drop shadow is and line that up with the bottom right hand corner of this shadow div tag.

By offsetting the image we are going to be able to see this. Now, I'm going to go ahead and click OK and save the file. Now, if we previewed this right now, you still really wouldn't see anything, and I'll show you. If I preview that in my browser, I can see there is my image, but there is no drop shadow. The reason is the drop shadow is being entirely covered up right now by this image. So if we can move the image out of the way slightly, we should be able to see the drop shadow. So next, I'm going to go into my CSS. So scroll up and find the #mainContent img rule.

Now, that is a generic rule that's targeting all the images inside the main content. So I don't really have something that's really specific here for only the images that I want to put drop shadows on. This rule is pretty much saying I'm going to apply drop shadows to all images in the main content. So I'm going to go ahead and double- click that and I'm going to go down to the Positioning attribute. I want to change this to relative. Now, most examples that I have seen of this technique use a negative margin to offset the image. I like using relative positioning offsets, because I found it to be more stable across multiple browsers.

The next thing I'm going to do is to give it a Left value of -4 pixels, and a Top value of -4 pixels. Now remember that's the width of our drop shadow, so we are moving our image to the left and up by 4 pixels. That should reveal just the drop shadow and nothing else. I am going to go ahead and click OK, do a Save All, and preview that in my browser. Sure enough, cool, there is our drop shadow on our image. Now, if I scroll down, I notice that not every image in here has a drop shadow. One of the benefits of this technique is that you can target any image that you want to have the drop shadow.

Now, in the case of our shadow class selector that we have written, it's also controlling a lot of the positioning of the image. I'll talk more about that in just a moment, and that's why this other image is not positioning properly. So at this point we have made the decision to have every image in here of a drop shadow and now we have tied in some positioning with it as well. So I'm going to go ahead and close that and let's see how easy it is to apply a drop shadow. I'm going to scroll down, find our second image and select that, so I'm just going to click on this Chicago image down here. Going up to my Insert toolbar, I'm going to go to my Common objects and I want to insert a div tag.

There is a reason that I selected the image beforehand, and if you have it selected, when you click the Insert Div Tag icon, it's going to default to wrapping around the selection. So it assumes you want to put a div tag around that element, and indeed we do. We also want to assign a class, so I'm going to go ahead and give this a class of shadow. As soon as I do that and click OK, you can see what happens. I'm going to save the file, preview that in my browser, and now its drop shadows is working as well. That's pretty simple, right? Well, not really. What I didn't show you is that due to the fact that we have to float the outer div tag, the entire layout had to change to accommodate that float.

The main content now floats to the right to contain the image float, and the h2 tags need clearing to prevent them from wrapping the images. The images are now being centered by positioning the wrapper div tag, not the more generic auto-margin technique. So again, if this doesn't really meaning anything to you, don't panic. In the chapter on layout we cover all those topics. What I'm trying to illustrate however is that most techniques don't work perfectly 100% of the time. You will need to learn to be flexible and plan ahead so that you don't have to choose between your original layout and your drop shadows.

Find answers to the most frequently asked questions about Dreamweaver CS4 with CSS Essential Training .

Expand all | Collapse all
please wait ...
Q: Is it possible to use CSS to create drop shadow effects over patterns and other backgrounds that aren't 100% white?
A: Try using the CSS3 drop shadow property, or use transparent PNGs as background images. A useful technique is detailed here: The technique covered in the "CSS drop shadows" movie in the Dreamweaver CS4 with CSS Essential Training course will work if the drop-shadow file is prepared with a transparent background and saved as a 24 bit PNG file.
Q: While attempting to share assets between layers of a Fireworks file, as instructed in the Chapter 3 tutorial “Page creation and asset sharing,” an error message reads "Master page layers are not editable from other pages. Shared layers cannot be made a sub layer.”
A: This problem often occurs when attempting to edit or move a layer that is set as a master page layer. To avoid this error, switch to the master page and note the shared layers. Any editing to those layers must be done while on the master page.
Q: Is it possible to build a page using Dreamweaver CS4 Starter Pages, then use the CSS code in a site that was written using Visual Studio? In Chapter 2, the author states that the CSS must be embedded within Dreamweaver. Does that mean a Starter Page cannot be used withing a site built with another tool?
A: When the author states, "the CSS must be placed inside the page," he is referring to the creation of custom Starter Pages, in addition to the ones already included in Dreamweaver. Once the Starter Page is created, CSS can be placed as embedded styles or in an external style sheet, so it is possible to use Starter Pages with Visual Studio or another web design tool.
Q: In the "Preparing custom starter pages" video, the author’s screen shows the CSS Styles panel with listings displayed in an outline mode, connected by vertical lines. How can I get my CSS Styles panel to display this way? I am using a Mac, while the author uses a Windows machine. Is this a case where the difference is based on the specific operating system?
A: That is indeed one of the (minor) interface differences between the Mac and the PC. In the Mac version of Dreamweaver, the All view of the CSS Styles panel shows top-level CSS files or style tags with a small triangle beside them. They can still be explored or minimized by clicking on them to toggle them. They still show an "outline" view, just without the connecting lines. The functionality is not affected in any way.
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


You have completed Dreamweaver CS4 with CSS Essential Training.

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


Upgrade to View Courses Offline


With our new Desktop App, Annual Premium Members can download courses for Internet-free viewing.

Upgrade Now

After upgrading, download Desktop App Here.

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:

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

Start your FREE 10-day trial

Begin learning software, business, and creative skills—anytime,
anywhere—with video instruction from recognized industry experts. provides
Unlimited access to over 4,000 courses—more than 100,000 video tutorials
Expert-led instruction
On-the-go learning. Watch from your computer, tablet, or mobile device. Switch back and forth as you choose.
Start Your FREE Trial Now

A trusted source for knowledge.


We provide training to more than 4 million people, and our members tell us that helps them stay ahead of software updates, pick up brand-new skills, switch careers, land promotions, and explore new hobbies. What can we help you do?

Thanks for signing up.

We’ll send you a confirmation email shortly.

Sign up and receive emails about 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

Sign up and receive emails about 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.