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

Styling images with CSS

From: Dreamweaver CS6 Essential Training

Video: Styling images with CSS

Usually placing the image on the page is just the beginning of making sure it fits within the design of your site. While there are certain properties that you can set manually on an image, for the most part you will want to customize the look and feel of your images through CSS. Using styles allows you to create different looks and behaviors based on where the image is found, the context in which it is being used or what type of image it is. The other rather obvious advantage to using styles for images is the ease of updating them. Rather than having to find dozens or even hundreds of images and modifying them individually you can update their specific style and have the change occur site wide.

Styling images with CSS

Usually placing the image on the page is just the beginning of making sure it fits within the design of your site. While there are certain properties that you can set manually on an image, for the most part you will want to customize the look and feel of your images through CSS. Using styles allows you to create different looks and behaviors based on where the image is found, the context in which it is being used or what type of image it is. The other rather obvious advantage to using styles for images is the ease of updating them. Rather than having to find dozens or even hundreds of images and modifying them individually you can update their specific style and have the change occur site wide.

So to experiment with styling our images, I am going to go back to the Index file this time in the 07_07 folder and just as a recap from our previous movie if I select the image that we modified, the image Properties in our last movie I can see that it has the Class, articleImg applied to it and that's the selector that we are going to work with when modifying the styling of this image. Another thing I want to do is I really like to be able to kind of see what's going to happen to this image as we style it, so I am going to work with Live View turned on. I am going to go ahead and turn Live View on.

Live View always jumps you back up to the top of the page, so I am just going to scroll back down again and I can see where the image is sitting. Now there are a couple of things I would like to do here. Number one, I really don't like the way that the image and the text are interacting with each other, that is to say they're really not interacting with each other at all. The image is sort of sitting there and the text is on the same line and that's because to the browser into HTML, this image and this line of text, they are both objects that occupy that particular line box. It doesn't really realize that the image is much taller than the text.

So I would really like the text to wrap around the image and I would like to style the image a little bit to give it a little bit of distinction, may be a bit of a border on the outside perhaps even a little fake bevel look to it. Nothing tacky I promise. So what I want to do now is I want to go over to the CSS Styles Panel and I want to find the selector that we are going to be modifying, and remember we are looking for the articleImg Class, so I am going to scroll down through my styles. I am going to collapse my Files Panel too, that's going to make it a little bit easier for me to find this. And as I scroll down through here, what I am looking for is right there, img.articleImg.

So that means any image with the class of article image applied to it. I am going to double-click that and again, that's going to open up the CSS Rule Definition dialog box. I am going to move this just to the right a little bit so that when I make changes to the styles I can see those changes reflected over here on my image. All right! The first thing I am going to do is I am going to give this a Background color. Which may seem a little odd, you may say, well why would you want to give an image a background color the image is going to sit on top of it. For the most part, but here we have the Box model properties like Padding that can cause some of this background to be visible.

So what I am going to do is for the Background-color, I am going to grab just a color chip here. I am going to choose kind of a neutral gray, maybe this second neutral gray which is the rgb(204,204,204). Now you are probably seeing something a little different there, am I right? Are you seeing a Pound symbol followed by letters and numbers? Well, that's hexadecimal notation. If I want I can to right over here to this little fly-out and I can tell it which Color Format to write the colors in. So I could come down here and say Three or Six-digit Hex. If I say Three-digit Hex which is the default, if I scroll down, now I can find the gray I am looking at is #CCC.

So it doesn't really matter which color format you have selected, we are just going to choose that sort of light gray color. Okay the next thing I want to do is go to my Box Model Properties and for Padding I am going to leave it Same for all, and I am just going to change to the Padding to 10 pixels. Now as soon as I do that, when I start making these changes, a lot of times I will have an idea as to what I want to happen with my image but until I actually see it in the context of the page, I don't know whether that was what I was going for or not. So Dreamweaver gives us a really nice little feature of instead of being able to commit and saying okay and then having to edit the style, I can come over here in the right-hand side and I can say Apply, and as soon as I do that, Live View is going to update, it's going to show me exactly what that's doing to my image.

You can see that because of the padding, this 10 pixels worth of padding that we have applied to the image, now that part of the background shows through and it gives us this kind of thick border look which is really nice. Now the next thing I want to do is I want to Float this image because I really want the text to wrap all the way around it. So from the Float pulldown menu, I am going to choose left because I want the image to be on the left-hand side of the text and then for Margin, I am going to deselect Same for all, and I am going to do about a Right margin of say 1em, which is basically equal to one character size of the text.

When I apply that, I can now see that the text is now wrapping around the image exactly the way I want it to and I can see that the Right margin that we applied here is pushing the text away from the image by about one character width, which is kind of exactly what I was going for. All right! Now I want to enhance this a little bit further by going over to my Border properties and what I want to do in my Border Properties, I am going to turn off Same for all, because I only want to apply a border on two edges. I am going to apply on the right and the bottom edge. It's going to give it just kind of fake bevel look. Now before you grown bear with me here, because if you do it subtly enough, it doesn't look that bad.

I am going to take the Style for the Right one, I am going to do solid, and Style for bottom I am going to do solid and I am going to do one pixel for each of those and then for the actual color itself, you can kind of experiment around with this a little bit, but I am going to go one up on this gray. From CCC I am going to go to 999 and that's a nice subtle change in color and when I apply that you can see it just gives it a real nice, subtle almost beveled look to the edge of that. Now in some situations where you have this on a darker background you might even want to do a highlight color on the Top and the Left, but since we are against a white background, that really is not going to do a whole lot for us.

So I am going to go ahead and click OK and I am extremely happy with my image styling, so I am just going to kind of leave it the way it is. It's one of the benefits of being able to hit Apply instead of just OK. It allows you to sort of preview your changes before you commit to them and it saves that sort of editing time that you would do otherwise. Now by no means is this a limit of what you can do with images in CSS. It's actually a pretty simple example. Now part of the fun of using CSS is the creative exploration that it can lead to. So I want to encourage you to just experiment with your images combining borders, background colors, padding and margins even try some of the new effects like box shadows and things like that for maximum creative effect.

Now the important thing to remember is that you can use CSS to control the visual presentation of images, making sure that they conform to the overall design strategy of your site.

Show transcript

This video is part of

Image for Dreamweaver CS6 Essential Training
Dreamweaver CS6 Essential Training

90 video lessons · 53627 viewers

James Williamson
Author

 
Expand all | Collapse all
  1. 1m 4s
    1. What is Dreamweaver?
      1m 4s
  2. 5m 44s
    1. Welcome
      1m 4s
    2. Using the exercise files
      2m 17s
    3. Learning web design
      2m 23s
  3. 1h 0m
    1. Looking at the Welcome screen
      5m 9s
    2. Exploring Windows and Mac interface differences
      5m 6s
    3. Arranging panels
      8m 44s
    4. Managing workspaces
      10m 14s
    5. Exploring the Application toolbar
      6m 21s
    6. Exploring the Document toolbar
      8m 47s
    7. Working with the Property inspector
      9m 30s
    8. Using the Insert panel
      6m 30s
  4. 53m 3s
    1. Understanding basic site structure
      3m 46s
    2. Exploring file naming conventions
      2m 10s
    3. Defining a new site
      5m 23s
    4. Managing files and folders
      7m 57s
    5. Adding remote servers
      7m 4s
    6. Uploading files
      12m 46s
    7. Previewing in browsers
      9m 11s
    8. Managing multiple sites
      4m 46s
  5. 36m 41s
    1. Creating new documents
      6m 49s
    2. Setting up new document preferences
      5m 30s
    3. Setting accessibility preferences
      6m 49s
    4. Working with starter pages
      4m 32s
    5. Managing starter pages
      13m 1s
  6. 37m 23s
    1. Getting text into Dreamweaver
      8m 43s
    2. Importing Word documents
      4m 6s
    3. Adding structure to text
      7m 35s
    4. Creating lists
      4m 35s
    5. Creating definition lists
      4m 0s
    6. Using the Quick Tag Editor
      8m 24s
  7. 44m 41s
    1. Exploring the Code toolbar
      5m 41s
    2. Setting code preferences
      7m 19s
    3. Using code hints
      8m 8s
    4. Wrapping tags
      5m 7s
    5. Adding comments
      6m 29s
    6. Using snippets
      7m 32s
    7. Formatting source code
      4m 25s
  8. 1h 19m
    1. Setting CSS preferences
      9m 32s
    2. An overview of the CSS Styles panel
      9m 23s
    3. Creating a new CSS rule
      6m 42s
    4. Using the CSS Rule Definition dialog
      7m 25s
    5. Organizing styles
      7m 22s
    6. Modifying style properties
      6m 17s
    7. Controlling CSS through the Property inspector
      6m 37s
    8. Attaching external style sheets
      5m 54s
    9. Using CSS visual aids
      7m 3s
    10. Using CSS Inspect
      6m 48s
    11. Using the Code Navigator
      6m 39s
  9. 1h 11m
    1. Managing assets in Dreamweaver
      7m 30s
    2. Setting external image editing preferences
      4m 26s
    3. Placing images on the page
      10m 12s
    4. Exploring Photoshop integration
      7m 17s
    5. Modifying Smart Objects
      9m 42s
    6. Modifying image properties
      8m 4s
    7. Styling images with CSS
      6m 45s
    8. Using background graphics
      7m 28s
    9. Positioning background graphics
      10m 10s
  10. 36m 23s
    1. Link basics
      3m 17s
    2. Setting site linking preferences
      2m 19s
    3. Creating links in Dreamweaver
      9m 17s
    4. Using absolute links
      3m 43s
    5. Using named anchors
      6m 41s
    6. Creating an email link
      5m 25s
    7. Creating CSS-based rollovers
      5m 41s
  11. 44m 30s
    1. Reviewing table structure
      5m 20s
    2. Importing tabular data
      6m 46s
    3. Creating accessible tables
      6m 11s
    4. Exploring basic table styling
      9m 42s
    5. Styling alternate rows
      8m 57s
    6. Creating custom table borders
      7m 34s
  12. 59m 15s
    1. Understanding how forms work
      2m 45s
    2. Reviewing form design
      3m 44s
    3. Creating accessible forms
      5m 16s
    4. Setting form properties
      2m 39s
    5. Using the fieldset and legend tags
      2m 52s
    6. Inserting text fields
      6m 56s
    7. Inserting list menu items
      7m 54s
    8. Inserting checkboxes
      4m 14s
    9. Inserting radio button groups
      3m 52s
    10. Inserting submit buttons
      2m 25s
    11. Exploring basic form styling
      8m 2s
    12. Exploring form element styling
      8m 36s
  13. 33m 25s
    1. Adding CSS3 transitions
      8m 29s
    2. Spry overview
      2m 44s
    3. Using Spry widgets
      3m 57s
    4. Adding Spry effects
      8m 1s
    5. Using the Widget Browser
      7m 4s
    6. Extending Dreamweaver
      3m 10s
  14. 1m 2s
    1. Additional resources
      1m 2s

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