How to allow horizontal scrolling in a web page

12,853

Solution 1

Set overflow to scroll

#body{
  overflow-x: scroll;
}

Solution 2

Try overflow scroll

table
{
 overflow: scroll;
}
Share:
12,853
Darf Zon
Author by

Darf Zon

Updated on June 05, 2022

Comments

  • Darf Zon
    Darf Zon almost 2 years

    I'm planning to display a table with a large width, so I havent' founded a CSS o HTML code to display this table and can move in a horizontally way

    enter image description here

    The only part which should be with horizontal scrolling is in the center (the white color). Here is my defaul razor view.

    <!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>