Interactive side menu with vertical scrolling functionality

Struggling with CSS code here. I want my website to be full screen and responsive, without any scrolling up and down. Tried different height settings like height:100vh, height: 100%, and height:1920px, but still facing the issue. Searched everywhere for a solution that aligns with my requirements but no luck so far.

https://i.sstatic.net/TTgwk.png https://i.sstatic.net/KfyK6.png

* {
    margin: 0px;
    padding: 0px;
    font-family:sans-serif ;

}
body{
    height: 100%;
    width: 100%;
}
#sidebar{
    margin: 90px 0px;
    position: absolute;
    width: 300px;
    height: 100%;
    background:#22356C ;
    left: -240px;
    transition: all 500ms linear;
}
#sidebar.active{
    left:0px;
}
#sidebar ul li {
   color:white;
   list-style: none;
    text-align: center;
    padding: 15px 10px;

}
#sidebar .toggle-btn{
    position: absolute;
    left: 310px;
    top: 5px;
}
#sidebar .toggle-btn span{
    display: block;
    width: 30px;
    height: 5px;
    background:#22356C ;
    margin: 5px 0px ;
}
#menu{
    position: absolute;
    margin: 40px 220px;
    height: 128px;
    width: 100%;

}
#menu1{
position: absolute;
    margin:0px 100px;
    color:white;
    list-style: block;
}
#bolock{
    height: 100%;
    width: 100%;
}
#page{
    position: absolute;
    margin: 90px 50px;


}
<!DOCTYPE html>
<html lang="en">
.................
</html>

responsive sidebar

Answer №1

Make sure to include the following CSS property:

overflow: hidden

This property should be added to the body tag in your code.

Answer №2

It seems like you're looking to prevent scrolling on a webpage completely. In that case, simply add overflow: hidden; to the body and your page won't scroll at all unless there are internal links present. (Find out more about overflow here)

Alternatively, if you want the body to scroll but keep a sidebar fixed in place without scrolling along with the rest of the content, you can use the position: fixed; property in CSS for the specific element you want to stay static. This will prevent it from scrolling with the rest of the page. (Learn more about positions here)

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

What is the best way to access a model attribute in every template?

My goal is to showcase the name of my model team in the website header. The Team model has a attribute named "name": class Team(models.Model): name = models.CharField(max_length=50, null=True, blank=True) In my template language, I am trying to disp ...

Trigger a click based on the CSS path starting from a specific element in the DOM

I am currently developing a feature for mouse activities, such as moving the mouse, clicking, and scrolling. I want to be able to record these activities and then playback them later on. So far, I have successfully recorded mouse movement, and now I need t ...

Looking to verify a disabled select element and adjust the opacity of that element when it is disabled

$_product = $this->getProduct(); $_attributes = Mage::helper('core')->decorateArray($this->getAllowAttributes()); ?> <?php if ($_product->isSaleable() && count($_attributes)):?> <dl> <?php foreach($_attrib ...

Is there a way to troubleshoot and resolve the error code I am encountering while using Angular Bootstrap and

1- When working on "app.component.html," I utilized a starter template code found at this link 2- To install Bootstrap 4, I ran the command "npm install bootstrap@4 --save" in the terminal. 3- I added references to style.css as per the Bootstrap installa ...

How to locate and extract text after a particular string using Selenium Internet Explorer driver in Java

How can I determine if the text that comes after "FIND ME PLEASE" is either "YES" or "NO"? For example, "FIND ME PLEASE 1" corresponds to "YES", while "FIND ME PLEASE 2" corresponds to "NO". Refer to the HTML snippet below: <table width="600" border="1 ...

The webpage does not dynamically resize based on screen height

Encountered an issue with the excess space below the footer. Resolved it by implementing a jQuery sticky footer as CSS techniques were unsuccessful. However, facing a problem with the main content of the webpage. Adjustment of .bg-photo's height impa ...

Running yarn build in react results in CSS modifications

When working in my local development environment, I have everything functioning as intended. However, after executing yarn build, all of my styles appear drastically different. The project was set up using create-react-app and styled with regular CSS. Bel ...

Creating a contact page with Font Awesome icons similar to my design using Flexbox in CSS

How can I achieve the desired layout for this image? I have written some code and applied CSS to get the output, but I encountered an issue. When the text in my address section is too large, the icon gets misaligned and collapses. How can I fix this issue ...

Issues with divs not aligning properly

Having trouble centering the results of freeCodeCamp's Twitch.TV project? Even though you've tried using margin: auto and class='text-center', the section containing the results remains left-aligned. How can you ensure that the results ...

Tips for dynamically retrieving a CSS file for an HTML page

With multiple html pages containing the same navbar, I made the decision to place the navbar in its own file called navbar.html and use ajax with jquery.get() to dynamically load it onto each page. This prevents redundant code across all pages. Currently, ...

Error encountered while trying to upload a file using PHP on a hosting platform

Hey everyone, I'm feeling really frustrated right now because I'm facing a file upload error in my PHP code. The issue is that the file is not getting uploaded to my folder and no error messages are being displayed. I've been working on cr ...

Creating unique URLs for websites can be accomplished by following these steps:

I am in the process of developing a website where content in the main div within the body section can be replaced. However, I have realized that all content will end up on the same URL. Any suggestions on how to fix this? HTML/PHP(index.php): <htm ...

What is the best way to incorporate Bootstrap's datepicker into a website?

I'm currently working on an AngularJS application. Here is the code I have: <directive date="date" date-format="YYYY-MM-DD" > <input ng-model="Date" type="text"/> </directive> Is there a way to integrate an Angu ...

Content will not be visible within the HTML template

While attempting to incorporate an HTML template I discovered online, everything seemed to be functioning correctly except for the fact that the text was not appearing. Following a tutorial required me to use a static file to load the site. Another issue I ...

Choose an element at random

I am trying to figure out how to select all div elements with the same class of "dot" under a parent div in JavaScript. Here is an example structure: <div id="dots"> <div class="dot"> . </div> <div class="dot"> . </div> ...

Drawing images in a sequence from an array of images: Java implementation

section, I am endeavoring to develop a sprite class containing 3 frames in each array representing different directions. The goal is for this class to incorporate an actionlistener and keylistener so that when I press W, the class will animate the sprite ...

Material-UI Grid in Full Width Mode is malfunctioning

I've been delving into the Material-UI@next grid layout system to grasp its intricacies. What I'm aiming for is to have two papers that stretch across the entire width of the screen and collapse into one paper when the screen size shrinks. The d ...

conceal Bootstrap dropdown using specific media query conditions

I am facing an issue with a bootstrap dropdown that remains open even after the screen is resized to hide the dropdown button. I have searched for a solution, but none of the answers I found have helped me so far. Is there a way to close the dropdown or r ...

Determine the position of an element in relation to a specific ancestor using JavaScript

Let's consider the following example of HTML code: <div id="site_header_container" class="site_bar_container"> <div id="site_header"> <div id="header_logo_container"> <a class="sliced" id="header_ ...

Issue with Error in Expanding Label in Material-Ui using React

I have managed to increase the size of the Label in the TextField component of my React application. However, I am encountering an issue where it overlaps some text on its right when it shrinks. https://i.sstatic.net/BikHJ.png Here is the link for refere ...