在div中滚动 [英] Scrolling in a div

查看:107
本文介绍了在div中滚动的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

正如你在下面的图片中看到的那样,我在屏幕的大小上有一个红色的div,我想要的只是使内容在该区域可滚动。有没有办法做到这一点?




整个pad的css:

$ $ p $ #mainWindow {
margin-left:auto;
margin-right:auto;
background-image:url(../ images / mainWindow.png);
背景大小:100%100%;
身高:100%;
宽度:80%;
padding:55px 60px 95px 65px;
box-sizing:border-box;
职位:亲属;
}

屏幕的CSS:

  #screen {
border:1px solid red;
宽度:100%;
身高:100%;


解决方案

尝试添加 overflow-y:scroll 到您的 #mainWindow CSS声明。



或者替代 #screen CSS声明。)


As you can see in the image below, I have a red div at the size of the "screen", what I want to is to make content scrollable in that area only. Is there a way to do that?

The whole pad's css:

#mainWindow{
    margin-left:auto;
    margin-right:auto;
    background-image:url("../images/mainWindow.png");
    background-size:100% 100%;
    height:100%;
    width:80%;
    padding:55px 60px 95px 65px;
    box-sizing:border-box;
    position: relative;
}

Screen's css:

#screen{
    border:1px solid red;
    width:100%;
    height:100%;
}

解决方案

Try adding overflow-y: scroll to your #mainWindow CSS declaration.

(Or alternatively to your #screen CSS declaration.)

这篇关于在div中滚动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆