Why does my container div move?
A website I am designing has a container div in order to make the website viewable in smaller screen resolutions. I have centred it using css (margin:0 auto and position:relative) and in the majority of my pages I have a two column layout, but in the pages where I have altered the layout to one column the entire container div moves to the right. The contents still appears centred in the container div. I have searched and searched as to what I am doing to cause this, so anyone who can help gets a pint!
Thanks - that is an excellent website!
- HJLv 49 years agoFavorite Answer
the removal of one of the columns is making your div move because its position is relative to other elements on the page. removing one element effectively removes x many pixels from one direction or the other, meaning your div will move accordingly.
if you could post some code that would help. otherwise, i'd suggest using a main 'wrapper' div, or series of divs, and putting your columns in that/them, meaning your column divs won't just be relative to each other.
alternatively , cos that didn't make any sense, find the layouts you're after at http://www.dynamicdrive.com/style/layouts/ and take a look at the css for themSource(s): it is half past midnight and I'm still at work, so this may not be a great answer given how tired it am...