Solution to the left and right jitter in the DIVCSS web page layout.
I have been having this problem recently when designing a website. I have designed the member center so that the content is margin: 0 auto; when it is centered, the webpage will swing to the left the moment you open the webpage, and when you enter another page, the webpage will move to the right again. Swing it once, and then swing it back to the left. If you jump frequently in the page, you will feel dizzy. The reason is that when the height of the web page is not enough, the scroll bar on the right will not come out. The width of the web page here needs to be added with the scroll bar. width, margin: 0 auto;, the web page is centered, but when the height of the web page allows the browser to display a scroll bar, the width of the web page here will of course be subtracted from the width of the scroll bar, and then the web page will Swing a little to the left
Otherwise, do you understand what is said above? Many people must have experienced this situation. The solution is very simple. Just make the right scroll bar appear all the time in the style sheet (CSS). If the web page is not high enough, the browser will scroll right. When the bar is running, let it come out. The code is:
Example Source Code
[www.downcodes.com] html{overflow-y:scroll;}
It's very simple, but when I write a web page, the header looks like this:
Example Source Code
[www.downcodes.com] <?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="zh-CN" lang="zh-CN">