The overflow:hidden property prevents me from being able to scroll down the rest of my webpage

@import url('https://fonts.googleapis.com/css?family=Indie+Flower|Lobster|Open+Sans+Condensed:300|Roboto+Condensed&display=swap');
* {
margin: 0;
padding: 0;
}
html,body {
    height: 100%;
    width: 100%;
    margin: 0px;
    padding: 0px;
    overflow: hidden;
}
body {
    background-color: #e0e0d1;
}
nav.Top-Nav.container {
   border-radius: 7px;
}
.Top-Nav {
display: flex;
padding: 5px;
background-color: #131930;
max-width: 1140px;
width: 100%;
margin: 0 auto;
min-height: 60px;
justify-content: space-between;
}
div.brandName {
font-family: 'Lobster', cursive;
font-size: 20px;
}
div.brandName span#cap {
    font-size: 50px;
}
ul.List a {
   font-family: 'Roboto Condensed', sans-serif;
}
div.brandName, ul.List a {
text-transform: uppercase;
color: #acaaaf;

}
span#frm-style {
font-family: 'Indie Flower', cursive;
color: cadetblue;
    font-size: 25px;
}
ul.List {
display: flex;
text-decoration: none;
list-style: none;
margin-bottom: 0;

}
ul.List a {
  padding-left: 10px;
  padding-top: 34px;
}
.dropdown-icon {
display: none;
}
div.offer-note {
    text-transform: uppercase;
    text-align: center;
    display: block;
}
div.offer-note1 {
    text-transform: uppercase;
    text-align: center;
    display: block;
}
div.offer-note1 p {
    margin: 0;
    padding-top: 5px;
    padding-left: 1px;
    color: #629fa3;
    font-size: 15px;
    
}
button.offer-btn1 {
    background-color: cadetblue;
    border-radius: 7px;
    width: 180px;
    height: 40px;
    font-size: 15px;
    margin-left: 23px;
}

div.offer-note p {
    margin: 0;
    padding-top: 140px;
    padding-left: 15px;
    color: #629fa3;
    font-size: 15px;
    
}
span.click-offer {
    font-size: 25px;
    color: whitesmoke;
    text-shadow: 3px 3px 5px black;
}
button.offer-btn {
    margin-left: 98px;
    background-color: cadetblue;
    border-radius: 7px;
    width: 100px;
    height: 40px;
    font-size: 20px bold;
}
button.offer-btn:hover{
    background-color: #0f2729;
    color: whitesmoke;
}
div.fish-toon4 {
    width: 80%;
}
iframe.Fish-vid1 {
    width: 90%;
    height: 400px;
}
img.sec2-firstfish-pic {
    display: block;
    margin: auto;
    cursor: pointer;
    width: 70%;
    height: 600px;
}
h1.about-me {
    font-size: 70px;
    display: block;
    padding-left: 80px;
}
div.fishem img.fish-pic {
    height: 80%;
    max-width: 100px;
    display: block;
    margin-top: 50px;
}

/*############ COLUM ##################
.col-1{width:8.33%;}
....

...

....
col-12{width:100%;}
.row {
    width: 100%;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
}
row::after {
    display: table;
    clear: both;
    content: "";
}
*/
/*##############MOBILE#################*/

@media only screen and (max-width: 375px) {
    ul.List li a.nav-link {
        list-style: none;
        display: none;
    }
     ul.List.responsive li.show-responsive a {
        list-style: none;
        display: flex;
    }
}




@media only screen and (max-width: 768px) {
    ul.List li a.nav-link {
        list-style: none;
        display: none;
    }

  ul.List.responsive li a.nav-link {
    display: none;
  }
  ul.List li dropdown-icon {
      ...
<!DOCTYPE html>
....

...

.....

<script type="text/javascript" src="farm.js"></script>
<script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.12.9/umd/popper.min.js" integrity="sha384-ApNbgh9B+Y1QKtv3Rn7W3mgPxhU9K/ScQsAP7hUibX39j7fakFPskvXusvfa0b4Q" crossorigin="anonymous"></script>
    <script src="bootstrap-4.0.0-dist/js/bootstrap.min.js"></script>
        
        
        
</body>
</html>

I'm facing an issue with spacing on my webpage after applying styles to make it mobile responsive. The page now has excess space on the right side, causing it to scroll unnecessarily. I attempted to fix this by setting the height and width of html and body elements to 100%, removing margins and paddings, and adding overflow: hidden. This helped prevent scrolling to the right but disabled all scrolling functionality on the page. Any advice or solutions would be greatly appreciated.

Answer №1

A quick fix is to modify overflow: hidden to only hide the overflow on the X axis: overflow-x: hidden.

Keep in mind that height: 100%; width: 100%; may not be necessary and can possibly be removed after testing for cross-browser consistency.

@import url('https://fonts.googleapis.com/css?family=Indie+Flower|Lobster|Open+Sans+Condensed:300|Roboto+Condensed&display=swap');
* {
margin: 0;
padding: 0;
}
html,body {
    margin: 0px;
    padding: 0px;
    overflow-x: hidden;
}
body {
    background-color: #e0e0d1;
}
nav.Top-Nav.container {
   border-radius: 7px;
}
.Top-Nav {
display: flex;
padding: 5px;
background-color: #131930;
max-width: 1140px;
width: 100%;
margin: 0 auto;
min-height: 60px;
justify-content: space-between;
}
div.brandName {
font-family: 'Lobster', cursive;
font-size: 20px;
}
div.brandName span#cap {
    font-size: 50px;
}
ul.List a {
   font-family: 'Roboto Condensed', sans-serif;
}
div.brandName, ul.List a {
text-transform: uppercase;
color: #acaaaf;

}
span#frm-style {
font-family: 'Indie Flower', cursive;
color: cadetblue;
    font-size: 25px;
}
ul.List {
display: flex;
text-decoration: none;
list-style: none;
margin-bottom: 0;

}
ul.List a {
  padding-left: 10px;
  padding-top: 34px;
}
.dropdown-icon {
display: none;
}
div.offer-note {
    text-transform: uppercase;
    text-align: center;
    display: block;
}
div.offer-note1 {
    text-transform: uppercase;
    text-align: center;
    display: block;
}
div.offer-note1 p {
    margin: 0;
    padding-top: 5px;
    padding-left: 1px;
    color: #629fa3;
    font-size: 15px;
    
}
button.offer-btn1 {
    background-color: cadetblue;
    border-radius: 7px;
    width: 180px;
    height: 40px;
    font-size: 15px;
    margin-left: 23px;
}

div.offer-note p {
    margin: 0;
    padding-top: 140px;
    padding-left: 15px;
    color: #629fa3;
    font-size: 15px;
    
}
span.click-offer {
    font-size: 25px;
    color: whitesmoke;
    text-shadow: 3px 3px 5px black;
}
button.offer-btn {
    margin-left: 98px;
    background-color: cadetblue;
    border-radius: 7px;
    width: 100px;
    height: 40px;
    font-size: 20px bold;
}
button.offer-btn:hover{
    background-color: #0f2729;
    color: whitesmoke;
}
div.fish-toon4 {
    width: 80%;
}
iframe.Fish-vid1 {
    width: 90%;
    height: 400px;
}
img.sec2-firstfish-pic {
    display: block;
    margin: auto;
    cursor: pointer;
    width: 70%;
    height: 600px;
}
h1.about-me {
    font-size: 70px;
    display: block;
    padding-left: 80px;
}
div.fishem img.fish-pic {
    height: 80%;
    max-width: 100px;
    display: block;
    margin-top: 50px;
}
/* ... CSS Snippet Continues Here... */
<!DOCTYPE html>
<html lang="en">
   <head>
      <title>Unique Title</title>
      <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0">
      <link rel="stylesheet" href="bootstrap-4.0.0-dist/css/bootstrap-grid.min.css">
      <link rel="stylesheet" href="bootstrap-4.0.0-dist/css/bootstrap.min.css">
      <link rel="stylesheet" type="text/css" href="style.css">
      <link rel="stylesheet" type="text/css" href="https://stackpath.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css">
   </head>
   <body>
       <!-- Content Goes Here -->
   </body>
</html>

Answer №2

To organize all content within the <body>, I suggest placing it inside a div element with the following style properties: position: fixed or absolute; height: 100%; width: 100%; top: 0; and omitting overflow.

Please test this out and let me know if it meets your needs.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

How can I close the colorbox and open a new regular window when clicking a hyperlink?

Hey there, I'm currently facing an issue with closing a colorbox when clicking "Click here to return to our website" and opening a regular browser window instead. You can check out the problem on this page: On the left navigation bar at the bottom i ...

Is there a way to left-align these items?

I currently have 10 divs arranged side by side. I am trying to align the last divs to the left instead of center, but the solutions I found so far are not working. I've checked Bootstrap's documentation and tried using <div class="d-flex ...

"Troubleshooting: Why is :last-child not applying styles to my final

I'm encountering an issue in my example where the last </li> doesn't display properly when using :last-child. In the provided code, you can observe that when I target the last element with the class "aa," it shows the "+ Add" text. &.a ...

Currently, my main focus is on finding a solution to adjusting the background color of the div element named *topnav* to properly match the width of the

I'm having trouble adjusting the width of the topnav background color to fill the entire page without any gaps. I hope that makes sense. Let me know if you need more information. Page displaying gap: Here is the HTML and CSS code: body {background ...

Is there a way to split the text into distinct pages within a contenteditable area, similar to the functionality in Google Docs

I've been working on developing a specialized browser-based text editor and I've encountered a puzzling question. How can I detect and split long texts into separate pages, similar to how Google Docs handles pagination? I'm aware that Google ...

Effective ways to enable users to upload files in a React Native app

Being in the process of developing a react native app, I am faced with the challenge of allowing users to easily upload files from their mobile devices (pdf, doc, etc). Unfortunately, my search for a suitable native component has proven fruitless. Can anyo ...

Troubleshooting an Angular.js "Hello World" application that is malfunctioning

I've been trying to get a simple Hello World app working by following different tutorials, but it doesn't seem to be functioning correctly. I've double-checked my code and everything looks right to me. Could someone please assist me in troub ...

Ways to create gaps among the links in the Bootstrap 4 navigation bar?

I recently put together a Bootstrap 4 navbar and now I'm looking to increase the spacing between the items on the right side of the navbar. <nav id="menu" class="navbar navbar-expand-md sticky-top"> <div class="site-branding navbar-brand c ...

Having issues with your JQuery code?

I am attempting to locate a cell within a table that contains the class 'empty'. My goal is to then utilize a code snippet to obtain the id (cell number) and determine which cells are adjacent to it. As part of my test, I am experimenting with t ...

Choose a Vue filter according to the variable selected

My Current Table Dilemma Creating a table from a 2D array in Vue2 has been successful for me, as I've managed to display all the values correctly. However, I am facing issues with formatting. The template code is structured like this: <table> ...

Upon calling the method, an undesirable page refresh occurs

I have been experimenting with dynamically generating additional input fields using vuejs when a user clicks a button. Initially, my code functions properly by creating more fields, but unexpectedly the page refreshes automatically, resetting the user&apos ...

`Count the number of rows needed to accommodate text line breaks within a div element`

Is there a method to determine the number of lines that text breaks into using the CSS property word-break: break-all? For example, if I have a div like this: <div>Sample text to check how many lines the text is broken into</div> And the corr ...

How can I stop full-page auto-scroll screenshot extensions from automatically scrolling?

As the owner of a membership website, I'm faced with the challenge of preventing users from easily taking full page screenshots of the valuable text content in my members area. Many browser extensions, such as Fireshot and GoFullPage, enable auto-scro ...

Issue arising from failure to check the checkbox

My ajax request is sending form data to an external PHP script and returning a result, but I'm encountering an error: Uncaught SyntaxError: Unexpected token < index.php hr.onreadystatechange This error occurs when trying to send the form without ...

Please indicate the maximum number of digits allowed after the decimal point in the input

My input form uses a comma as the decimal separator: HTML: <form id="myform"> <label for="field">Required, decimal number:</label> <input class="left" id="field" name="field"> <br/> <input type="submit" va ...

Set the background color of the container row to extend the full width, encompassing

I am working on a grid container and I want to change the background color of the second row within it. Check out my Fiddle This is the HTML markup: <div class="totalContainer totalContainer__space"> <div class="totalContainer__ ...

What is the best way to horizontally align my div content while ensuring it is responsive, alongside a sidebar and top menu on the same

I am facing an issue trying to center my div content responsively with a sidebar menu and a top menu using Bootstrap. However, when I require the side-menu file, my div content gets placed at the bottom of the page unexpectedly. I am only using Bootstrap 5 ...

Unshrinkable item causing multiple lines text-overflow in a flexbox layout

My goal is to achieve the following design: https://i.stack.imgur.com/YLUtN.png Currently, I have attempted the following approach (although it doesn't fully meet my requirements): .parent { max-height: 40px; display: flex; flex-wrap: wrap; ...

Switching Symbols with JQuery

Hello, I am brand new to utilizing javascript and I'm currently experimenting with the toggle function. My goal is to create show/hide functionality while also toggling arrow icons. Specifically, I want a right arrow next to the link "More -->" and ...

Creating a stylish CSS button with split colors that run horizontally

Could you please provide some guidance on creating a button design similar to this one? I've made progress with the code shown below, but still need to make adjustments like changing the font. <!DOCTYPE html> <html> <head> <sty ...