Dreamweaver FAQ header image 2

How can I center a div tag top to bottom?

March 16th, 2009 · No Comments

Hi Janine

In Total Training for Adobe Dreamweaver CS3, you show how to center a div tag with CSS left to right. But how about top to bottom? Somehow I can’t make that work.

Hope you can help,
John

Hi, John,

You can’t use the auto margins trick for top to bottom alignment, but you can set a margin on the top and/or bottom of a div and position it anywhere on the page that way.

For example, if you have a div that is 100 pixels high and you want to center it between what’s above and below in a space that is 200 pixels high, you can set the top and bottom margins to 50. That will position it in the middle.

Hope that helps,
Janine

Still want more? Visit the Dreamweaver Help Center at www.DigitalFamily.com/dreamweaver to find Dreamweaver tips, tricks, and tutorials.

Tags: Dreamweaver CS3 · Dreamweaver CS4

0 responses so far ↓

  • There are no comments yet...Kick things off by filling out the form below.

You must log in to post a comment.