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

2014 年 7 月 24 日3720

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

代码如下:

<div>

<div>

<asp:RadioButtonList runat="server" DataTextField="className" DataValueField="classID"

ForeColor="#FF4040">

</asp:RadioButtonList>

<asp:ImageButton runat="server" ImageUrl="~/images/c_sure.jpg" />

<asp:ImageButton 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

更多信息请查看IT技术专栏

0 0