Top and bottom margin for container/wrapper divs

This is a discussion on "Top and bottom margin for container/wrapper divs" within the Web Page Design section. This forum, and the thread "Top and bottom margin for container/wrapper divs are both part of the Design Your Website category.



Go Back   Webforumz.com > Main Forums > Design Your Website > Web Page Design

Notices


Reply
 
LinkBack Thread Tools
  #1 (permalink)  
Old Feb 27th, 2006, 09:03
Up'n'Coming Member
Join Date: Feb 2006
Location: London
Age: 25
Posts: 98
Thanks: 0
Thanked 0 Times in 0 Posts
Top and bottom margin for container/wrapper divs

If you use auto for the left and right it will center the div horizontally, I tried using the following code to center the div vertically but it dosen't work.

Is there a way to center the div vertically?

#container{ margin-top: auto;
margin-bottom: auto;
margin-left: auto;
margin-right: auto;
width:700px;
height:510px;
}


Thanks!
Jim.
Reply With Quote

  #2 (permalink)  
Old Feb 27th, 2006, 12:40
herkalees's Avatar
Highly Reputable Member
Join Date: Jul 2005
Location: Massachusetts, USA
Age: 87
Posts: 576
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to herkalees Send a message via MSN to herkalees Send a message via Yahoo to herkalees
Re: Top and bottom margin for container/wrapper divs

position: relative; (if not, try absolute)
top: 50%;
height: 400px; (must declare a height)
margin-top: -200px; (must be half the above height)
Reply With Quote
Reply

Tags
top, bottom, margin, containerwrapper, divs

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
Wrapper problem goldy Web Page Design 2 May 30th, 2008 19:11
CSS margin-bottom property problem cangoalie Web Page Design 12 Mar 8th, 2008 20:40
My navigation breaks my wrapper. tigerslicer Web Page Design 6 Sep 10th, 2007 10:58
Trying to align a div in a wrapper AdRock Web Page Design 7 Feb 22nd, 2007 16:03
Divs within another div go to the bottom of page... Nitesh9999 Web Page Design 10 Mar 1st, 2006 14:08


All times are GMT. The time now is 07:06.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43