【问题标题】:C# asp:ListBox hide vertical scrollbarC# asp:ListBox 隐藏垂直滚动条
【发布时间】:2012-11-01 09:24:47
【问题描述】:

如何隐藏 div 中存在的 Listbox 的垂直滚动条。

<div id="lstQueriesDiv" style="overflow-y: hidden !important; overflow-x: auto !important;
         Width: 650px; height:167px;" > 
 <asp:ListBox ID="lstQueries" runat="server" CssClass="cssLstQueries" Rows="9"></asp:ListBox>
</div>

css:

    .cssLstQueries{
    Width:auto;
    }

我想隐藏列表框的垂直滚动条而不是 div 的垂直滚动条。

【问题讨论】:

标签: c# asp.net css


【解决方案1】:

删除OVERFLOW:auto;来自

<div id="lstQueriesDiv" style="OVERFLOW:auto; Width: 650px; height:167px;" > 

因为它覆盖了 overflow: hidden; 所在的 CSS 类

【讨论】:

  • 当我删除了 OVERFLOW:auto;水平滚动条消失了。
  • 我需要 div 的水平滚动条并移除列表框的垂直滚动条
  • 所以设置溢出-x:隐藏;溢出-y:自动;就像 pranay_stacker 说的
  • .cssLstQueries{ Width:auto; } 仍然没有水平滚动条
  • 问题是listbox的垂直滚动条是可见的。
【解决方案2】:

在对象属性中设置滚动条

【讨论】:

    猜你喜欢
    • 2013-10-26
    • 1970-01-01
    • 2013-02-12
    • 1970-01-01
    • 2017-02-08
    • 1970-01-01
    • 1970-01-01
    • 2012-10-21
    • 2011-02-05
    相关资源
    最近更新 更多