Content page is positioned in the center using the class .all

.all{ margin:auto; padding:0px; width:1000px; } 

When a vertical scroll bar appears, the content shifts by some px to the left.

How to get rid of this bad "effect"?

    2 answers 2

    Add to the body overflow-y:scroll; and the scroll bar will always be, and when the content zone is smaller in height than the height of the window, scrolling will not be active, but it will already take its place, and such a shift effect will not occur.

    PS Property is invalid!

    • I wrote invalid. Expert - fixed to invalid. What does it mean invalid? (Expert's question). It works, only the css validation will not work - there will be an error, there is no such blessing in the specification. - triplustri
    • I, of course, not Expert, but the word "invalid" is not in Russian. and the word valid is translated exactly like this))) - LeD4eG
    • The word validity in Russian is exactly. Indifferently - one-root short adjective, everything seems to be true, although I could be wrong ... - triplustri
    • Yes, there is a word. it is derived from the English term. but the formation of adverbs is slang. You and I understand this, which means the term "invalid", but in fact it should sound different: "the document did not pass validation." Now there is the word "satisfaction" (approximately satisfaction), but when it is necessary to use "unsatisfactory" - we do not say "unsatisfying." - LeD4eG
    • Yes, quite logical, convinced. Nevertheless, in this context, invalid is not a synonym invalid, at least under the validity / non-validity is understood compliance / non-compliance with certain standards, but not really completely. The author of the post may incorrectly understand the word "invalid", thinking that it does not work or something else like this ... - triplustri

    Well, it is logical that the appearance will shift to the left, because the display of the page already has less pixels in width. Since you have margin-left and margin-right to "automatic mode", the value of the fields changes with the width of the page. But in order for the content to remain in the middle of the display area, an offset effect occurs. I'm afraid that this can not be avoided ...