I have a menu that slides in from offscreen. There's no horizontal scrollbar showing, but you can still slide the screen manually (in IE and Chrome, not Firefox) and see the offscreen div in the horizontal overflow. Obviously, I really want it hidden.
A simple example (without the javascript to make the offscreen div slide in) can be seen here and below:
<div id="maintext">I'd like the footer to display below, but the offscreen div to the left to not be visible by scrolling.</div>
<div id="footer"></div>
<div id="offscreen"></div>
body{
overflow-x:hidden;
}
#footer{
position:absolute;
top:1000px;
width:100%;
height:10px;
background-color:#000000;
}
#offscreen{
position:absolute;
width:100%;
height:100%;
z-index:1200;
background-color:#000000;
right:-100%;
top:0;
}
How can I ensure the user cannot manually move the page horizontally? overflow-x:hidden on the body (or a wrapper div) doesn't work... Seems to be the vertical scroll that's causing the problem.
This can be solved creating a div wrapper inside of your body and applying overflow-x:hidden; to it.
Check this working fiddle (try to scroll it).
.wrapper {
overflow-x:hidden;
}
Related
So I am working on a site and I having an issue. The scrollbar seems to extend passed the window. I cant see the bottom arrow even with max res. It is even worse when I resize the window. The main problem with this is that I can see my footer, but for some users with smaller screen resolutions cant. Here is my css:
body {
display:block;
margin:0;
color:black;
width:100%;
height:100%;
overflow:scroll; }
Here are screens of what I am talking about:
full res: fullres
Resized window: resized
Any help is appreciated.
remove the overflow:scroll; from your body and put it on the specific div where you want the scroll to be
So your body css
body
{
display:block;
margin:0;
color:black;
width:100%;
height:100%;
}
Are you using any position absolute or fixed in your code ? i dont see it as a problem just this short code. I would prefer "auto" over "scroll" for overflow property.
I have a menu that slides in from offscreen. There's no horizontal scrollbar showing, but you can still slide the screen manually (in IE and Chrome, not Firefox) and see the offscreen div in the horizontal overflow. Obviously, I really want it hidden.
A simple example (without the javascript to make the offscreen div slide in) can be seen at https://jsfiddle.net/7g0x96hs/ and below:
<div id="maintext">I'd like the footer to display below, but the offscreen div to the left to not be visible by scrolling.</div>
<div id="footer"></div>
<div id="offscreen"></div>
body{
overflow-x:hidden;
}
#footer{
position:absolute;
top:1000px;
width:100%;
height:10px;
background-color:#000000;
}
#offscreen{
position:absolute;
width:100%;
height:100%;
z-index:1200;
background-color:#000000;
right:-100%;
top:0;
}
How can I ensure the user cannot manually move the page horizontally? overflow-x:hidden on the body (or a wrapper div) doesn't work... Seems to be the vertical scroll that's causing the problem.
Thanks!
I am currently building a website that uses two columns, inside a position fixed box to make the heights stay at 100%.
I need the content div to scroll down if the content is longer than the page (on 11/13" screens, page is responsive) - but by setting overflow scroll on the content, the background does not drop, and there is still content at the bottom of the page.
There are two links here, one is the page as it is, and the other is the page with extra content (to make it longer than your viewport)
Link 1 link 2
If you can help my solve this, i'll be thankful :)
Add Overflow:auto; It works fine. I checked it with that page.
The problem is the .bf_page is set to height: 100% - this is getting the full height of the body, however the div doesn't start at the top of the page so it continues under the bottom of the body tag for 100 or so pixels, meaning the last bit of content is getting chopped off (hope that makes sense?!).
The height of the logo (which is causing the page to extend) is 121px so you could do the following:
Change .bf_page's height to:
.bf_page {
height: calc(100% - 121px);
}
Set .bf_content_text to overflow: auto
I've tested that and it seems to work.
Taking out the "position: fixed;" on the '.bf_menu' class works for me, if you're having trouble getting the menu to stick to the top of the page, just hide the blockquote div with display:none.
Example:
<div id="wrapper">
<div id="content">
<div id="data">
</div>
</div>
</div>
#wrapper {
height:100vh;
width:100vw;
background-color:black;
position:absolute;
}
#content {
background-color:red;
height:80%;
width:80%;
position:relative;
overflow-y:auto;
}
#data {
background-color:yellow;
width:80%;
height:1000px;
}
http://jsfiddle.net/nGU8R/1/
So I have a fluid layout with a min-width on the body of 960px. I have a fixed header, which works as intended, and a right-side nav bar which I want to remain fixed on the vertical scroll... this also works.
However if I resize the window to less than 960px width I would like the right hand nav bar (position:fixed) to stay to the right on the horizontal scroll instead of overlaying the content.
#mainnav {
width:20%;
height:100%;
margin-left:80%;
position:fixed;
}
#mainhead{
position:fixed;
top:0px;
left:0px;
width:100%;
height:46px;
}
#contentcontain{
margin-top:46px;
width:80%;
}
I'm sure I could do it with using JS but I was just wondering if there is a more simple way to it without JS.
Thanks,
Dom
An element with position:fixed is pulled out of the normal flow of document layout and will always sit on top, unless you give it a z-index value.
Here is the sample code!
If the result area is too small and you will have to scroll down - some of featuresMenu text will hide behind the footer. How to prevent this, how to make featuresMenu to stick until it reaches footer?
Thanks!
body {
margin-bottom:50px;
}
#div_id {
position:fixed;
bottom:0;
right:0;
left:0;
width:100%;
height:50px;
}
this should do the trick, make sure whatever the height of div is you make a margin at the bottom of the page, so stuff doesn't hide there
Set the z-index of the floating div to 1, and the z-index of the footerdiv to -1.