As the browser window gets smaller, my side drawer starts to shrink in height

I'm currently working on a project that is supposed to have a certain look and feel.

https://i.sstatic.net/xmDtH.png

As part of the project, I created a collapsible side drawer. I positioned it absolutely to the document body with left 0 and top set to the height of the top bar. Initially, everything was working as planned until I resized the browser window to a smaller height, which resulted in the following display:

https://i.sstatic.net/mVplp.png

Despite my efforts, including setting the side drawer height to 100vh - top bar height and 100% - top bar height, I couldn't resolve the issue. As someone who is still learning about front-end development, any guidance or insights would be greatly appreciated!

Below is a snippet of the SCSS code used:

.control-panel {
  position: absolute;
  z-index: 1;
  background-color: lighten($profile-cards-role-extra-light-grey, 45%);
  width: 30rem;
  left: 0;
  min-height: calc(100vh - 9.4rem);
  box-shadow: 0 2px 6px 0 rgba(#000, 0.2);
  transition: margin, box-shadow, 0.3s ease-out;

  padding: 0 2rem;

  .toggler-btn {
    position: absolute;
    right: 0.8rem;
    top: 0.8rem;

Answer №1

Utilizing the vh unit means that it adjusts in relation to the height of the window. This causes it to decrease as the window size decreases, maintaining its ratio.

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

Troubleshooting problems with the width of a Bootstrap navbar

I'm encountering a frustrating issue with my bootstrap menu. When I include the "navbar Form" in the menu, the width of the menu extends beyond the screen width in mobile mode (when resizing the browser window or viewing on a mobile device). Interesti ...

I am in search of a container that has full height, along with unique footer and content characteristics

I have set up a jsfiddle to demonstrate the scenario I am facing: There is a basic header, content, footer layout. Within the content-container is a messenger that should expand to a maximum of 100% height. Beyond 100% height, it should become scrollable. ...

Beginner guides on creating combo boxes and Facebook-style message composers using CSS and Javascript (or JQuery)

1) Looking to revamp a combo box using CSS and minimal or no javascript. Seeking tutorials that can provide guidance. 2) Facebook users may have noticed the feature where typing in recipients creates a "button" around the user's name. Curious about h ...

How to customize the navigation bar color with Vue 3 and Bootstrap 5

Here's the navigation bar code: <nav class="navbar bg-body-tertiary navbar-expand-lg" data-bs-theme="dark" :class="{'navbar-expand-lg navbar-dark bg-dark ' : useDarkNavbar, 'navbar-expand-lg bg-light&a ...

Confirming user credentials for every page

I am currently working with an HTML page that includes front end PHP for server side scripting. One issue I have encountered is the configuration page, which can be accessed by disabling JavaScript in Mozilla settings. My current validation method relies ...

Ensuring elements are properly centered within a Bootstrap grid while adjusting the window size

I've been facing a challenge with making my web page resizable. Even though I managed to center the elements using margin properties, whenever I try resizing the browser window, the logo and ship images lose their positions. They end up falling out of ...

Internet Explorer 9 does not display content until the ajax/json function has finished executing

I have encountered an issue with my code regarding updating a div element. The first innerHTML call seems to be ineffective and does not render in the browser. However, the second innerHTML call works as expected by appending "Complete" once the ajax call ...

The text is placed below the image, rather than appearing alongside it

My website bby is supposed to be displayed right next to the image logo, but it's showing up under the logo for some reason. Can someone help me with this issue? You can view the current layout here This is the html code I have: body { font-si ...

Managing Cache Expirations

When I checked my website's performance using Google Webmaster Tools' PageSpeed analyzer, it highlighted that none of my resources were being cached. Here is the code snippet from my .htaccess file sourced directly from H5BP. I'm wondering i ...

Removing a function when changing screen size, specifically for responsive menus

$(document).ready(function () { // retrieve the width of the screen var screenWidth = 0; $(window).resize(function () { screenWidth = $(document).width(); // if the document's width is less than 768 pixels ...

Verify if the external web address includes a specific substring

Recently, I attempted to implement a new feature on my website that involved adding a button allowing users to search for a specific string from an external URL or another website. My current code snippet looks like this: $(document).ready(function () { ...

How to create a border using a repeated image with spacing between each repetition

Is there a way to create a dashed horizontal line from an image and adjust the spacing between each dash using HTML and CSS? I feel like using javascript for this would be excessive. https://i.sstatic.net/YiD9q.png I'm encountering this issue with t ...

Why does HTML5 show me an error stating that the 'value' attribute is not valid for text area in HTML5?

Here is the issue I am facing: Currently, I'm working on a C#.NET web application where I am incorporating HTML 5 views that include a text area field. Below is an example of what I have: <label for="nome">Description*:</label> <texta ...

Showing an HTML div on top of a Flash object

I have a flash slideshow with two overlapping divs - one at the top and one at the bottom. <header> <div id="top-menu"> <ul> <li>Main Menu Link</li> <li>Main Menu Link</li> <li>Main Menu Link</li&g ...

Implementing Individual Subpages for Each Row Using PHP and MySQL

I have a table with 4 columns (id, name, surname, url) and I want to create a unique subpage for each row (example.com/id?=444). When visiting example.com?id=444, the data from the row with id 444 should be displayed. Currently, I have a form where you ca ...

Finding all anchor tags in raw HTML using htmlagilitypack

My HTML document contains the following code snippet: string htmlData = "<!DOCTYPE html><html><Head></Head><body>&lt;div&gt;&lt;a target=\"_blank\" href=\"http://blender.palmbeachschools.org/GetFile ...

Trouble with insertAdjacentHTML not functioning properly on newly created element

I need to add a table below an h1 element that has the id of pageHeading. The hardcoded HTML for the h1 is: <h1 id="pageHeading">Table</h1> const pageHeading = document.querySelector("#pageHeading") The JavaScript code to c ...

HTML div ID displaying incorrectly

My main div on the page has the attribute align="center", but it does not seem to align in the center. If you'd like to see the page for reference, click here. This is the CSS: #page{ background-color: #4C1B1B; width:85%; height:500px; ...

Steps for transforming a text from xml into a clickable hyperlink in html with the help of xslt

Is there a way to transform text in an XML file into a hyperlink in HTML using XSLT? This is the XML code I am working with: <Steps> <Filepath>C:\Test\Capture\050615165617TC001_05_06_1516_57_11.png</Filepath> ...

Handling redirection on a single-page website without javascript functionality turned on

Currently, I am in the process of creating a single-page website using html, css, javascript, and php. My aim is to use jQuery for navigating through the website - allowing the content to fade out when a user clicks on a link in the navigation menu and hav ...