css - 如何在浏览器屏幕缩小时显示水平滚动条

标签 css asp.net-mvc browser scrollbar

这是我制作的仪表板。其中包含 4 个 DIV。 当浏览器完全打开时 when browser screen is fully opened 当我减小浏览器的屏幕尺寸时 When I decreases browser screen.

我希望每当浏览器屏幕减小时...仪表板 DIV 应该得到 水平滚动条 而不是切断显示。 这是我如何在主视图中呈现局部 View 的代码。

<fieldset>
    <%using (Ajax.BeginForm(new AjaxOptions { InsertionMode = InsertionMode.Replace}))/*, UpdateTargetId = "RecentDiv" }))*/
      { %>


    <div id="MainDashboardDiv">
        <div class="LiveTile">
            <div id="RecentDiv"> 
                    <h4 class="RequestTitle">
                    <%: Html.ActionLink("Recent Requests", "CRMRequestsList", new { requestType = "Recent" })%>
                    </h4>
                <%Html.RenderAction("RecentRequests",Model); %>
            </div>
            <!--End of RecentDiv -->

            <div id="PriorityDiv">
                <h4 class="RequestTitle">
                    <%: Html.ActionLink("High Priority Requests", "CRMRequestsList", new { requestType = "Priority" })%>
                 </h4>

                <%Html.RenderAction("PriorityRequests", Model); %>
            </div>
            <!--End of PriorityDiv -->
        </div>
        <!--End of UpperLiveTiles -->
        <div class="LiveTile">

             <div id="PendingDiv">
                <h4 class="RequestTitle">
                <%: Html.ActionLink("Pending Requests", "CRMRequestsList", new { requestType = "Pending" })%>
                </h4>
                <%Html.RenderAction("PendingRequests", Model); %>

            </div>
            <!--End of PendingDiv -->
            <div id="ApprovedDiv">
                    <h4 class="RequestTitle">
                    <%: Html.ActionLink("Approved Requests", "CRMRequestsList", new { requestType = "Approved" })%>
                    </h4>
                <%Html.RenderAction("ApprovedRequests", Model); %>

             </div>
            <!--End of ApprovedDiv -->


        </div>
        <!--End of LowerLiveTiles -->
    </div>
    <!--End of MainDashboardDiv -->
    <%} %>
    </fieldset>

这是我应用的 CSS:

#MainDashboardDiv {
    height: auto;
    width: 100%;
    margin: 0 auto;  
    padding-bottom: 4%; 
    overflow: hidden;

}
.LiveTile{
    height: 260px;
    overflow: hidden;
    padding-top: 1%;
    position: relative;
    width: 100%;
}

#RecentDiv, #PendingDiv
{
    width: 48%; 
    display: inline-block; 
    position: relative; 
    height:inherit;
    overflow: scroll;
    float: left;
    margin-bottom: 1%;
    margin-right: 1%;
    -webkit-border-radius: 12px;
    -moz-border-radius: 12px;
    border-radius: 12px;
    background:rgba(0,117,149,0.9);
}
#PriorityDiv,#ApprovedDiv
{

    width: 48%;  
    position: relative; 
    height:inherit;
    display: inline-block;
    overflow: scroll;
    float: left;
    margin-bottom: 1%;
    margin-right: 1%;
    -webkit-border-radius: 12px;
    -moz-border-radius: 12px;
    border-radius: 12px;
    background:rgba(0,117,149,0.9);

}

最佳答案

这种风格是罪魁祸首。

.LiveTile{
    overflow: hidden;
}

您是在告诉它隐藏任何超出范围的内容。试试 scrollauto

.LiveTile{
    overflow: scroll;
}

或者

.LiveTile{
    overflow: auto;
}

编辑:

抱歉,我想我把你的标记搞混了,你想定位标题下的 div。尝试将 Html.RenderAction("RecentRequests",Model);Html.RenderAction("PriorityRequests",Model); 等包装在一个 div 中并将其应用于该 div .

HTML

<div id="RecentDiv"> 
        <h4 class="RequestTitle">
        <%: Html.ActionLink("Recent Requests", "CRMRequestsList", new { requestType = "Recent" })%>
    </h4>
    <div class="InnerDiv">
        <%Html.RenderAction("RecentRequests",Model); %>
    </div>
</div>

CSS

.InnerDiv {
    overflow:scroll;
}

关于css - 如何在浏览器屏幕缩小时显示水平滚动条,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15739112/

相关文章:

jquery/css 向下滑动但子元素不应移动

html - html表格中多行拆分查看长句

html - 如何将 StringBuilder 的内容显示为 HTML?

javascript - 如何使用 onsubmit 表单 asp.net mvc 模型中的数据更新 Javascript 中的 div 标签

javascript - HTML - 如何检查文件(.js 或 .css)是否已加载或从缓存中获取?

html - silverlight 应用程序的浏览器滚动条问题。(Html)

javascript - 禁用输入字段填充 1 个字符时自动跳转到下一个输入字段

javascript - 在 ASP.NET MVC 中向 JavaScript 文件公开资源字符串的最佳方法?

javascript - Javascript 中的空间 (2D) 声音

'overflow-y:auto' 的 CSS 问题在 Chrome 中产生了问题,但在 Firefox 中没有