当前位置:编程学习 > html/css >>

html中设置超出部分自动显示滚动条

在html页面中,我们有时需要让div中的内容超出后自动显示滚动条,我们可以这样设置:
[csharp]  
<div class="classlist">  
        <div class="autoScroll">  
            <asp:RadioButtonList ID="rblClasses" runat="server" DataTextField="className" DataValueField="classID"  
                ForeColor="#FF4040">  
            </asp:RadioButtonList>  
            <br />  
            <asp:ImageButton ID="imgSure" runat="server" ImageUrl="~/images/c_sure.jpg" />  
            <asp:ImageButton ID="imgClose" runat="server" ImageUrl="~/images/c_close.jpg" />  
        </div>  
    </div>  
 
然后,样式中这样设置:
[css]  
<style type="text/css">  
        .classlist  
        {  
            width: 300px;  
            height: 20px;  
        }  
        .autoScroll  
        {  
            width:300px;  
            height:100px;  
            overflow:auto;             
        }  
        #rblClasses  
        {  
            margin-left: 20px;  
        }  
</style>  
设置后,当radiobutton中显示的内容超出最外围的div时,将自动显示滚动条,即嵌套div
补充:web前端 , HTML/CSS  ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,