Jump to content

Stop content moving when vertical scroller appears - margin: auto


denno020

Recommended Posts

I have auto margins for left and right for my wrapper to centre it in the page. When the page is longer than the browser window, obviously the vertical scroll will appear. However, when that happens, the wrapper will shift to the left so that it is still in the centre. Is there any way of avoiding this?

 

Thanks

Luke

Link to comment
Share on other sites

do you mean shift to the left the 18 pixels the scrollbar is width? If that is the case maybe use javascript to check the length of the page according to the screen height, and if the one is larger than expected set margin-right to -18pixels.

Not sure though, but that was just that popped up here :)

 

Why would you want do that, to prevent the little shift?

 

or maybe put the wrapper on overflow hidden and put a container in that with overflow:scroll; But i am now just brain farting :D

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.