如何在网页中允许水平滚动

Dar*_*Zon 2 html css razor asp.net-mvc-3 asp.net-mvc-4

我打算显示一个大宽度的表格,所以我还没有建立CSS或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>
Run Code Online (Sandbox Code Playgroud)

Luc*_*oni 5

设置溢出滚动

#body{
  overflow-x: scroll;
}
Run Code Online (Sandbox Code Playgroud)