Get Started with Expression Web

Five Ways to Customize the Interface in Expression Web

Change Link Colors and Remove The Underline

Create External Style Sheets to Save Time with CSS

Center Div Tags in a CSS Layout with Expression Web

Create Images Styles to Align Images with the Float Option

Add Meta Descriptions for Search Engine Optimization

Create a Rollover Image with the Swap Image Behavior

Make Global Updates with Dynamic Web Templates

Testing Web Site Accessibility

Test Your Web site Before You Publish in Online

Desire to learn design? Order video training for...

Expression Web Training Video

Microsoft Expression Web Essentials Video

How to Upgrade from FrontPage to Expression Web

Advanced Expression Web Training Video

Visit Total Training.com to find video training for all your favorite software programs.

Return to the Expression Web Training Center

Looking for ASP.NET Web hosting?

www.1and1.com,ada web hosting service which also claims to be the largest domain registrar in the world

You'll find many more Microsoft recommended Web servers at www.asp.net/hosters/

 

Partners and sponsors

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

advertisement

Free Greeting Card, Expires 2-27-07

Trusted by over 7 million customers!

Total Training

Center Div Tags in a CSS Layout with Expression Web

CSS is the best way to create page designs these days, but if you want your designs centered when displayed in a browser, you’ll need to know this little trick.

Partners and sponsors

Order Your Expression Web Training Video Today!

1. First, you have to specify a width of the div tag you want to center, and it has to be smaller than the display area, otherwise the divs will extend all the way across the page. To do so, select the outer most div in your design. In this example, I've named that div #container. Right-click on the name of the div and choose Modify Style (if you haven't yet applied any style to a div, choose New Style).

Figure EW Tutorial 4-1.jpg

 

2. In the Modify Style or New Style dialog, select the Position category, and enter a width. In this example, I set the width to 800 pixels.

Figure EW Tutorial 4-2.jpg

 

3. Now the tricky part. To center a div on the page, you need to set the margins left and right to auto. The effect of this is that the browser will automatically set an equal amount of space on each side of the div, effectively placing it in the center of the page. To do this, choose the Box category in the Modify Style or New Style dialog and set the left and right margins to auto.

Figure EW Tutorial 4-3.jpg

 

4. When you save the new style (and it is applied to the div) the page will automatically be centered, like the design shown here in Internet Explorer.

Figure EW Tutorial 4-4.jpg

Centering your page designs helps create the appearance that your designs fill the screen no matter what size the browser window is or what size monitor your visitor uses.

Go on to Tip 5 | Return to Expression Web main page

Partners and sponsors

Order Your Expression Web Training Video Today!

Shutterfly.com