Home > Web Front-end > CSS Tutorial > How to Completely Disable Horizontal Scrolling on Your Website?

How to Completely Disable Horizontal Scrolling on Your Website?

Linda Hamilton
Release: 2024-11-02 05:22:30
Original
970 people have browsed it

How to Completely Disable Horizontal Scrolling on Your Website?

How to Completely Disable Horizontal Scrolling

To physically disable the horizontal scroll feature on your webpage, follow these steps:

  1. CSS Rule in HTML Tag:

    • In the tag, specify both max-width: 100%; and overflow-x: hidden; CSS rules to ensure that the page cannot exceed the width of the browser window and that horizontal scrolling is disabled.
  2. Complete CSS Code:

    <code class="css">html, body {
        max-width: 100%;
        overflow-x: hidden;
    }</code>
    Copy after login
  3. Implementation:

    • Include the CSS code in an external stylesheet or add it to the