user1624005 user1624005 - 4 months ago 10
CSS Question

Page moves slightly to the right with same CSS

I've recently put a website online, and everything is going well, the site looks good, it all works, but there's one very subtle problem that I can't find the root of.

To see what I'm talking about, go to edited out . Click on one of the parts where it says "X comments", and watch the left side of the page. It moves, just a bit.

Now, maybe this doesn't matter at all, but it's been bugging me that I can't find the reason. Anyone have any ideas?

Answer

This kind of behaviour happens frequently. The problem is that the scrollbar appears only some times and nudges everything centered or right aligned. To prevent this, the best solution is to simply make sure the scroll bar always appears:

body{
overflow-y:scroll;
}