1 reply [Last post]
homecomer
Offline
newbie
Last seen: 12 years 15 weeks ago
Timezone: GMT+1
Joined: 2010-01-30
Posts: 1
Points: 2

Hello everyone!

I'll try my best to explain what I mean. I hope this makes sense:

I have had som trouble getting my site layout to work.

I've used absolute positioning with a 50% value for top and left alignment, and then used a negative margins to center the whole site.

The problem is that in a small window the content doesn't stop at the top and left corner, but instead it proceeds out of the frame...

Is there any way too solve this?

Thanks!

gary.turner
gary.turner's picture
Offline
Moderator
Dallas
Last seen: 1 year 11 weeks ago
Dallas
Timezone: GMT-6
Joined: 2004-06-25
Posts: 9776
Points: 3858

That is a work-around for IE

That is a work-around for IE 6/7, and no, there is no fix. The combination of positioning offsets and negative margins means that if the viewport becomes smaller than the centered element, 0ne-half of the overflow will be lost to the left and/or the top, with no scrolling available. For modern browsers, and for IE v.8+, set the lateral margin to auto, and using the display value of table or table-cell, set vertical-align to middle to center vertically.

cheers,

gary

If your web page is as clever as you can make it, it's probably too clever for you to debug or maintain.