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

Complex background graphics

From: Dreamweaver CS4 with CSS Essential Training

Video: Complex background graphics

Often some of the most simple design elements actually turn out to be very complex once you start attempting to style them. Coming up with creative solutions to CSS problems are just as much a part of your designing with CSS, as planning the layout in the first place. To illustrate this point, our next exercise we'll focus on supplying quotation mark graphics to our blockquotes, and doing something really cool with our pages' background graphics. Now, I have seen many blockquote styled with quotation marks around graphics, but most of these will be a single graphic at the top of the blockquote to highlight the nature of the element.

Complex background graphics

Often some of the most simple design elements actually turn out to be very complex once you start attempting to style them. Coming up with creative solutions to CSS problems are just as much a part of your designing with CSS, as planning the layout in the first place. To illustrate this point, our next exercise we'll focus on supplying quotation mark graphics to our blockquotes, and doing something really cool with our pages' background graphics. Now, I have seen many blockquote styled with quotation marks around graphics, but most of these will be a single graphic at the top of the blockquote to highlight the nature of the element.

What we want to do is have a subtle background graphic that shows a graphic quotation mark underneath the beginning of the quote and one underneath the person's name of the quote. You can see that here, here we have the opening quotation mark, here we have the closing quotation mark. Now, if all the quotes were exactly of the same size, we could create one larger background graphic and just be done with it, but of course that's not going to be the case. So we'll need our quotations marks to be placed in the proper location, regardless of the size of the quote. This will require us to add little bit of extra markup, but as you are going to find out, we can make that logical and semantic.

So I'm going to leave Firefox and go back into Dreamweaver, and open up the 06_10 file. Now I'm going to scroll down to find our blockquote, and for the most part it's styling exactly the way we want it to. The one thing it is not doing however is it's not displaying our background graphic. So what I'm going to do is go over to my CSS Styles, find my blockquote rule and double click that. I'm going to go to the Background category, and I'm going to browse for my Background-image. Now, I want to make sure I'm browsing in the 06_10/_images directory, and what I'm looking for is the upQuote.gif. Click OK.

Choose no-repeat for Background-repeat, and click OK again. So now our background graphic shows up. One of the really cool things about this is the padding that we have on the existing blockquote. In addition to the line height, it's giving us the spacing we need, so we don't even really have to do any positioning of our background graphic. Well, that takes care of the first half, what about the second half? This is where it gets tricky. We want to position the quotation mark roughly in the same position at the end of the name, and offset the name a bit from the rest of the blockquote. To do this, we'll throw a span around the name and write a specific style to it.

By treating the span as a block level element, we'll be able to position it separately from the rest of the blockquote and position the background graphic inside of it as desired. As a bonus, we are going to pass a class attribute into the span, so that the content is identified as well. So we are really doing something that helps pass along meaning as well. So I'm going to go ahead and highlight the text Thomas Wolfe plus the in dash here, and I'm going to wrap that in the span tag. One of the easiest ways to do that is to do a Command+T or Ctrl+T keyboard shortcut.

This is going to open up our Quick Tag Editor. When you have text highlighted, it's going to prompt you to wrap the selected text for the tag, and that's what we need to do here. So I'm going to type in . That class doesn't exist yet, so I wasn't able to grab it from my pull-down menu. So I'm going to hit Return, and visually nothing really happens, but we can see down here in our tag selector that we have added that. Perfect! So now we need to go ahead and create that as a CSS rule. So I'm going to go over to my CSS Styles panel, and you will notice I'm still focused on that blockquote style.

That's going to help me position my new style in the right place. I'm going to choose New CSS Rule, and here we are going to do compound selector. It's going to be a little less specific than this. So I'll hit Less Specific a few times. I get blockquote .quote. That's what I want, but I want to make this element specific. So I'm going to place my cursor directly in front of the period there, and type in span. Now, if you have never done an element- specific class selector before, make sure there is no spaces here. Notice that it just says span.quote.

So that means any span tag with the class quote applied to it inside of a blockquote. So still fairly specific. I am going to go ahead and click OK, and we are going to change a few things here. The first thing I'm going to change is how it's positioned. Span tags are by nature inline tags, but if I choose the Block category, I could make it display like a block level element. That's going to place it on its own line, and it's going to ensure that it's always at the bottom of our quote. Now, the next thing I'm going to do is take Text-align and set that to the right. That's going to move the name of the person who is giving the quote all the way to the right edge, which is actually fairly common in lot of quotes.

Next, let's go ahead and set some Type properties. What we are going to do here is change the font-weight to bold. That will make the name standout a little bit more. We are going to give it a line-height of 1.2. Now, we don't want to use pixels here, we are going to use multiples, and that will be basically 1.2 times the font size of the text. So it's going to give us a little bit of extra padding and extra space there. Speaking of padding, let's do that. Let's go to our Box category, and turn Same for all off for Padding. Let's give it a bottom padding of 2.4em. That's going to give us a lot of space between the text and the background image.

Let's give it a padding top of 0, and then let's give it a padding right of 2em. Again, it's going to give us an offset from the right and bottom, and allows enough space for a background image to show up. Now, speaking of that, that's the only thing we have left to do here. Let's go to our Background category. I'm going to browse for our Background-image. This time I'm looking for the downQuote.gif. So I want to find that. I click OK. Choose Background-repeat, no-repeat, and we do need to position this. So what I'm going to do is for Background-position (X), I'm going to give it a right value, and for Background-position (Y), I'm going to give it a bottom value.

That makes sure that the graphic also lines up with the bottom right hand corner of the element. So I'm going to go ahead and click OK, and there is our quotation mark right there. Now, this is going to move down regardless of how long our quote gets. If I selected a quote, copied it, and doubled it, it wouldn't matter. Quotation mark is going to go right down there with it. So that is really, really cool. I'll go ahead and undo that. Now, if I do a Save All here and preview that in our browser, you can see that it's working exactly the way that we want it to work.

Now, the really good news here is that now just surrounding any type of a name we have in a blockquote with the span tag and assigning it the class of quote is going to take care of all the styling that we need. The additional markup is fairly a minimal and not that difficult to add to the page. You can do a lot of variations on this technique, and add an infinite amount of visual sophistication to your pages with minimal markup. Now, speaking of minimal markup, before we move on to our next exercise, I want to turn our attention to our page background graphic. So I'm going to scroll it up there. You may remember from earlier that what we have is the HTML tag has one seamless style background on it, sort of this concrete pattern, and then the body tag itself has this background graphic, this long skyline sidebar.

Now, the top skyline image is a transparent PNG file. It has a sort of glow on it. Right now it's blending in with the background, and although that creates a really cool effect, this would have been just as easy to replicate by creating just a really long background graphic. So why go to the trouble of using that alpha transparency? Good question. Let's go back into our CSS and make a really quick modification to it and show you what a cool technique you can do by combining background graphics together. Okay. I'm going to back into my file.

I'm going to find the body selector. I'm just going to close my Files panel so I have more access to these properties, and I'm going to add a property. I'm going to add the background-attachment property. Now, this is one that might have been easier to grab with a pull-down menu. Let's check out some of the values for this. We have fixed, scroll, and inherit, so really two values. Now, basically, background-attachment doesn't have anything to do with the element itself and how the background positions itself relative to the element. What background-attachment allows you to do is set how the background graphic is positioned relative to the viewport.

So it can remain fixed to the viewport or it can scroll right along with the viewport. Now, scroll is the default value, so I'm going to choose fixed. When I do a Save All, and preview that in my browser, notice that now when I scroll, I get a very different result. That skyline stays in place. I can literally see the transparency on the glow as I'm scrolling through my page. So now we have a complex set of background graphics that completes the styling of our blockquotes. Now, I should point out that this background-attachment fixed property doesn't work properly in Internet Explorer.

Not only that, but earlier versions of Internet Explorer don't support alpha transparency on PNG files either, so that's sort of a double whammy for what we are doing here. That's okay though, because later on in the deployment chapter I'm going to show you how to filter out this code so that Internet Explorer has a very different result, without any errors or problems. So we have got a complex set of background graphics that complete the styling of our blockquotes, and we have modified our page background images to take full advantage of our header's transparent nature. Once you have the basics of background images down, allow yourself to experiment and explore with how you are using them.

You will most likely find that your creativity and design sensibilities will lead you to use them in totally unexpected and very effective ways.

Show transcript

This video is part of

Image for Dreamweaver CS4 with CSS Essential Training
Dreamweaver CS4 with CSS Essential Training

120 video lessons · 41680 viewers

James Williamson
Author

 
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 28s
    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 35s
    8. Working with Live view
      4m 12s
    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 14s
    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 51s
    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 48s
    1. Using lists for navigation
      1m 40s
    2. Creating horizontal menus pt. 1: Stripping list styling
      3m 28s
    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. 28m 59s
    1. Introducing Spry widgets
      2m 18s
    2. Updating the Spry framework
      45s
    3. Examining the default Spry styles
      6m 36s
    4. Modifying tabbed panels through CSS
      5m 18s
    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
      38s

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 Dreamweaver CS4 with CSS Essential Training.

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