【问题标题】:How to allow horizontal scrolling in a web page如何在网页中允许水平滚动
【发布时间】:2013-03-23 04:47:50
【问题描述】:

我打算显示一个宽大的表格,所以我没有创建一个CSS o HTML代码来显示这个表格并且可以水平移动

应该水平滚动的唯一部分是在中心(白色)。这是我的默认剃须刀视图。

<!DOCTYPE html>
<html lang="en">
    <head>
        <meta charset="utf-8" />
        <title>@ViewBag.Title</title>
        <link href="~/favicon.ico" rel="shortcut icon" type="image/x-icon" />
        <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0" />
        @Styles.Render("~/Content/css")
        @Styles.Render("~/Content/themes/base/css")
        @Scripts.Render("~/bundles/modernizr")
    </head>
    <body>
        <header>
            <div class="content-wrapper">
                <div class="float-left">
                    <p class="site-title">@Html.ActionLink("MS. GARCIA MATH 7TH", "Index", "Home")</p>
                </div>
                <div class="float-right">
                    <section id="login">
                        @Html.Partial("_LoginPartial")
                    </section>
                    <nav>...</nav>
                </div>
            </div>
        </header>
        <div id="body">
            @RenderSection("featured", required: false)
            <section class="content-wrapper main-content clear-fix">
                @RenderBody()
            </section>
        </div>
        <footer>
            ...
        </footer>

        @Scripts.Render("~/bundles/otf")

        @RenderSection("scripts", required: false)
    </body>
</html>

【问题讨论】:

  • 将其包裹在一个宽度有限的 div 中

标签: css asp.net-mvc-3 html razor asp.net-mvc-4


【解决方案1】:

设置溢出滚动

#body{
  overflow-x: scroll;
}

【讨论】:

    【解决方案2】:

    试试溢出滚动

    table
    {
     overflow: scroll;
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-05-05
      • 1970-01-01
      相关资源
      最近更新 更多