Who knows that stipulated in the web page creation div center don't go along with the scroll bar on the right side page how to do it
CodePudding user response:
Refer to the fixed position, has nothing to do with the documents in the position of the element, div { position: fixed; Width: 100 px; Height: 100 px; Background: red; Right: 20 px; Top: calc (50% - 50 px); }
CodePudding user response:
, the header, footer,. The main { display: block; } The header { position: fixed; top:0; left: 0; right:0; height:100px; }
The footer { position: fixed; Bottom: 0; left: 0; right:0; height: 30px; } . The main { /* main absolute positioning, an internal scroll */ position: absolute; /* the height of the top head */ Top: 100 px; /* at the bottom of the bottom is the height of the */ Bottom: 30 px; /* make roll can be */ Overflow - y: scroll; /* increase the elasticity of rolling, solve the problem of rolling not smooth */ - its - overflow - scrolling: touch; } , the main content { Height: 2000 px; }