简体   繁体   English

防止div溢出

[英]Prevent div from overflowing

I'm creating a horizontal animated page transition system where the screen scales to accomodate the incoming page. 我正在创建一个水平动画页面过渡系统,其中屏幕可以缩放以适应传入的页面。 The problem I have is when moving to a smaller page size, the previous (larger) page overflows out of my content wrapper and consequently causes my overall page to extend past the footer. 我遇到的问题是,当移到较小的页面大小时,前一个(较大)的页面溢出了我的内容包装程序,因此导致我的整个页面超出了页脚。 This screen capture shows my problem. 屏幕截图显示了我的问题。

You can see how the current page exits on the left, after the screen has shrunk to accomodate the incoming smaller page. 屏幕缩小以适应传入的较小页面后,您可以看到当前页面如何从左侧退出。 (the yellow is the footer, the white the unwanted screen extension). (黄色是页脚,白色是不需要的屏幕扩展名)。

Currently my "page" css is 目前,我的“页面” css是

.myPage
{
width: 100%;
max-width: 100%;

margin-left: auto;
margin-right: auto;

position: absolute;

top: 0;
left: 0;
display:none; /*Pages are displayed once called*/
opacity: 1;
}

I've attempted fiddling with overflow-y:hidden which I thought might work but no such luck. 我试图摆弄overflow-y:hidden,我以为可以工作,但是没有运气。

What can I do to keep my page class from extending out of my content and screwing up my page? 我该怎么做才能防止页面类超出内容范围并破坏页面?

EDIT: 编辑:

Here's the page wrapper. 这是页面包装器。

.pageWrapper
{
background: #FF0000;
position: relative;
width: 100%;
height: 100%;
-webkit-perspective: 1200px;
-moz-perspective: 1200px;
perspective: 1200px;
-webkit-transform: translateX(0%);
}

Edit2: A jsfiddle thats broken but features all my code Edit2: 一个jsfiddle多数民众赞成在打破,但功能我所有的代码

overflow-y won't work without a fixed height. overflow-y不会没有固定工作高度。 Try setting the height to 100% or some other value that looks right. 尝试将高度设置为100%或其他看起来正确的值。

In this case you could also set bottom instead of height to give the element a fixed height. 在这种情况下,您也可以设置bottom而不是height以将元素设置为固定高度。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM