html中设置让div中的内容超出后自动显示滚动条


在html页面中,我们有时需要让div中的内容超出后自动显示滚动条,我们可以这样设置:

复制代码
代码如下:

<div class="classlist">
<div class="autoScroll">
<asp:RadioButtonList ID="rblClasses" runat="server" DataTextField="className" DataValueField="classID"
ForeColor="#FF4040">
</asp:RadioButtonList>

<asp:ImageButton ID="imgSure" runat="server" ImageUrl="~/images/c_sure.jpg" />
<asp:ImageButton ID="imgClose" runat="server" ImageUrl="~/images/c_close.jpg" />
</div>
</div>

然后,样式中这样设置:

复制代码
代码如下:

<style type="text/css">
.classlist
{
width: 300px;
height: 20px;
}
.autoScroll
{
width:300px;
height:100px;
overflow:auto;
}
#rblClasses
{
margin-left: 20px;
}
</style>

设置后,当radiobutton中显示的内容超出最外围的div时,将自动显示滚动条,即嵌套div
« 
» 
快速导航

Copyright © 2016 phpStudy | 豫ICP备2021030365号-3