Just getting started?

Before you create your first Dreamweaver page, define your web site folder
(Lesson for Dreamweaver MX 2004, 8, CS3, and CS4
)

Should I create a web site or a WordPress blog (or both)?

Test your Web site

Browser Test your Web site in Internet Explorer, Firefox, Safari, and other web browers

Dreamweaver Videos

Janine Warner, training videos in Dreamweaver

Free Video Sample: A lesson in when to use Dreamweaver to create Tables or CSS -- and how play the chocolate game...

"Your videos are so engaging. Thank you."

Order a training video for Adobe Dreamweaver by best-selling author Janine Warner.

Featured Tutorials

Adding an Ecommerce shopping cart to a Dreamweaver web site is easier with Google Checkout

Google Checkout

How do you register a domain name? (Tips for finding the domain you want.)

Choosing the best web hosting service to publish your site

Designing with CSS

Why use Cascading Style Sheets (CSS)?

Customize a CSS Layout
(Dreamweaver CS3 or CS4)

ecommerce web site example

Align Images with CSS floats
(Dreamweaver CS3 or CS4)

Choose the right CSS selector : Class, ID, Tag, or Compound
( Dreamweaver CS4)

Choose the right CSS Selector: Class, Tag, or Advanced
(Dreamweaver CS3)

Templates & Themes

How to use templates in blogs and web sites

Designing templates for Adobe Dreamweaver

Designing WordPress templates in Dreamweaver

Testing, Traffic, Google AdSense, Ecommerce & more

Test your Web site in Internet Explorer, Firefox, Safari, and other web browers

Traffic counters, email spam protection, newsletter services, favicons, and more

How to add Google AdSense, Flickr, YouTube, and widgets

Creating drop-down menus with Spry

Add a Drop-Down Menu in Dreamweaver CS3 or CS4

Edit a Spry Drop-Down Menu created with Dreamweaver

Create Collapsible Panels with Spry in Adobe Dreamweaver CS3 or CS4

Find Answers in the Dreamweaver FAQ

Search for answers to your questions Janine's Dreamweaver FAQ.

Quick Quiz: Test your Dreamweaver Savvy
(play and learn)

What's new in Adobe Dreamweaver CS4

Do I have to learn HTML to create a web site?

Adding Flash (.flv & .swf) to Web Pages

Insert a Flash File (.swf) (Dreamweaver CS3, Cs4)

Insert a Flash Video (.flv)
(Dreamweaver CS3, CS4)

Convert video into Flash with the Flash Video Encoder

Dreamweaver CSS Tips

Create a Navigation Bar with an Unordered List and CSS
(Dreamweaver CS3)

Troubleshooting CSS (Dreamweaver CS3)

Compare Layout Options: Tables/Layers/AP Divs/CSS(Dreamweaver 8, CS3, MX)

Review: More places to learn advanced CSS tricks & techniques

Editing HTML Code

Editing HTML Code in Dreamweaver

Connect an HTML Form to a Script in Dreamweaver (Dreamweaver CS3, CS4)

Dreamweaver Behaviors and Extensions

Use Swap Image Behavior to Create Multiple Rollovers
(Dreamweaver CS3, CS4)

Swap Image Behavior

Use a Behavior to Launch a New Browser Window (Dreamweaver CS3, CS4)

Add new features to Dreamweaver with Extensions (Dreamweaver 8 and CS3)

Dreamweaver FAQ

FAQ: Get answers to your questions, and maybe even a few you hadn't thought of yet... Search the Dreamweaver FAQ

Compare creating a web site or blog in WordPress, Dreamweaver, or Joomla

Review: What's the best option? WordPress, Joomla, Dupal, and other content management systems (CMS) comparison

Review: What's the best Web design program? Adobe Dreamweaver or GoLive, Microsoft Expression Web or FrontPage?

 

partners and sponsors

Total Training Online Software Training - Try it Now Get Free Access

_______

Dreamweaver FAQ

Search for answers to your questions, and maybe even a few you hadn't thought of yet, in the Dreamweaver FAQ.

_______

Dreamweaver CS3 advertisement CS3-DW-125x125

Trusted by over 7 million customers!

Aligning Images with Floats, using CSS in Dreamweaver 8, CS3, and CS4

Align Images with CSSIf you've ever been frustrated by the limitations of V space and H space (that's vertical and horizontal space for those unfamiliar with HTML), you're going to love what CSS can do for your images.

In the days when H space and V space were the only options, you could add margins around images, but you had to add the same amount of space to both sides, which almost never looked good in anyone's design.
 
As you'll learn in this tutorial, using CSS to create styles for your images instead enables you to quickly and easily align images to the right or left of a page, and add margin space exactly where you want it to create space between the image and any text that wraps.

I routinely create two image styles for every site I work on, one that aligns an image to the right, with a little margin space on the left, and another that aligns images to the left, with a little margin space on the right. I often include a little margin at the bottom as well, just to make sure that text and other elements don't bump into the bottom of my pictures.

If you're still using V space and H space, this tutorial is for you. Thank your designer stars that CSS has given us a little more design control on the Web.

Partners and sponsors

Dreamweaver CS4 Video Training

STEP 1 Insert Images

Insert images into your page using Dreamweaver's standard insert image features. You can choose Insert>Image or click on the image icon in the Common insert bar at the top of the screen. Select the image you want to insert and click OK.


Insert Images

STEP 2 Create a New Class Style

Next, you'll want to create a new style for your images. Choose Text >CSS Styles>New. In the New CSS Rule dialog, select the Class radio button. Class styles are ideal for image styles like this because they can be used as many times as you want on each page and can be applied to images and other elements.

Enter a name for your style in the Name field. For this example, I called the style .image-right. Note that all class styles must begin with a period. If you don’t type one yourself, Dreamweaver will automatically add a period to the beginning of the style name when you create a class style.

If you choose the radio button next to This document only, your style will be saved in the head area of your HTML file. If you choose Define in, you can save your style in an external style sheet. The advantage is that you can attach the same external style sheet to any page in your web site, a more efficient option than recreating styles for every page, and an easy way to make global updates later. To create a new external style sheet as you create a new style, choose the radio button next to Define in and click OK. In the Save Style Sheet File dialog, enter a name for the external style sheet, and click OK to continue.

Create a New Class Style

STEP 3 Use Floats to Align Images

In the CSS Rule Definition dialog, choose the Box category from the left side. Click on the drop-down arrow next to Float and select Right.

Then set the Margins. First make sure the Same for All check box is not checked. When I align an image to right, I generally like to include 10 pixels of margin on the left, to create a margin between the image and the text that will wrap around the image when it is aligned right. I also like to include 10 pixels of margin on the bottom. Of course, you should set the amount of margin that works best for your design. Click OK to save the new style.


Use Floats to Align Images

STEP 4 Apply the New Style

To apply the new style, click to select the image you want to align, and then use the Class drop-down list in the Property inspector at the bottom of the page to choose the new style name. In this example, I'm selecting the style I just created called .image-right.  When you apply the style, the image is immediately aligned to the right and 10 pixels of margin space are added to the left and the bottom.

Apply the New Style

STEP 5 Create Additional Image Styles

Next, you'll want to create a style to align your images to the left. Choose Text >CSS Styles>New. In the New CSS Rule dialog, select the Class radio button and enter a name in the Name field. In this example, I called the style .image-left.

Choose the radio button next to Define in and select the name of an external style sheet from the drop-down list. Alternatively, you can save your style in the document you are working on by choosing This Document Only. Click OK to continue.

Create Additional Image Styles

STEP 6 Define Box Category Settings

 In the CSS Rule Definition dialog, choose the Box category from the left side of the dialog box. Use the drop-down arrow next to Float to choose Left. Then set the Margins. First make sure the Same for All check box is not checked. When I align an image to left, I generally like to include 10 pixels of margin on the right, to create a margin between the image and the text that will wrap around the image when it is aligned left. I also like to include 10 pixels of margin on the bottom. Click OK to save the new style.

Define Box Category Settings

STEP 7 Apply the New Style

To apply the new style, click to select the image you want to align, and then use the Class drop-down list in the Property inspector at the bottom of the page to choose the style name. In this case .image-left. When you apply the style, the image is immediately aligned to the right and 10 pixels of margin space are added to the left and the bottom.

Apply the New Style

You may want to create additional styles for images with varying amounts of margin space for different uses within your design, but I find that these two styles, image-right and an image-left, solve most of my basic image alignment needs. And if you save them in an external style sheet, as I've done in this tutorial, you can attach that same style sheet to other pages in your site and use the same styles for all your images.

This article by Janine Warner was originally created for Layers Magazine.

Return to Dreamweaver Training Center

Partners and sponsors

Dreamweaver CS4 Video Training