html - How to stop a fixed positioning going negative -


i updating site responsive design, has content in 1000px width container centres on viewport. want used fixed sidebar, want whole content still stick 1000px , centred in viewport, , when viewport less 1000px, bootstrap responsive design work. current best attempt follows:

<div id="wrapper">   <div id="page-content-wrapper"></div>   <div id="sidebar-wrapper"></div> </div> 

with css

#wrapper{     height: 100%;     position: fixed;     left: calc((100vw - 1000px)/2);     top: 0;     max-width: 1000px;     width: 100%;     overflow: auto; } #page-content-wrapper{     position: relative;     overflow-y: scroll;     height: 100%;     padding: 0px; } #sidebar-wrapper {     position: absolute;     top: 0px;     left: 250px; } 

this works fine until viewport less 1000px, @ time bootstrap works e.g. menus collapse, content starts disappearing left. because wrapper left position goes negative viewports less 1000px.

how do stop content disappearing when viewport less 1000px?

create media equerry, or use predifined bootstrap media queries

@media (max-width: 999px) {   #wrapper{     left: calc((100vw - 800px)/2);   } }  @media (max-width: 799px) {   #wrapper{     left: calc((100vw - 400px)/2);   } }  @media (max-width: 399px) {   #wrapper{     left: calc((100vw - 200px)/2);   } } 

Comments

Popular posts from this blog

qt - Using float or double for own QML classes -

Create Outlook appointment via C# .Net -

ios - Swift Array Resetting Itself -