Restricting the size of the component to match the height of its containing div

I set up a layout with a toolbar at the top, a sidenav on the left, and the remaining space for content.

The sidenav consists of a searchbox and a list of items. My goal is to have the sidenav's height match the row it's placed in, allowing the list to overflow and scroll within that defined height. However, I'm having trouble getting the inner scroll to function as desired, as the inner component's height exceeds the containing div's height and setting height: 100% isn't working.

Current display:

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

You can see that the entire left component is overflowing (I intend to eliminate the outer scroll using overflow: hidden), and the inner component expands to full size while the list doesn't adhere to the component's height limitations or its parent div's height.

Here are the HTML and CSS scripts:

logs.component.html

<div class="container">
  <div class="row">
    <div class="col-3" color="primary" class="sidebar-container">
      <app-search-sidebar (selectedChanged)="selected=$event" [items]="items"></app-search-sidebar>
    </div>
    <div class="col">
      <md-tab-group>
        <md-tab [label]="selected">
          <h1>{{selected}}</h1>
          <p>...</p>
        </md-tab>
      </md-tab-group>
    </div>
  </div>
</div>

logs.component.css

.row {
    width: 100%;
    margin: 0;
}

.row > .col* {
    padding: 0;
}

.container {
    display: flex;
    height: 100%;
    width: 100%;
    padding: 0;
    min-height: calc(100% - 64px);
    max-height: calc(100% - 64px);
}

app-search-sidebar {
    overflow-y: auto;
    display: block;
    height: 100%;
}

.sidebar-container {
  min-width: 300px;
  /*max-width: 300px;*/
}

.container > md-tab-group {
  margin-left: 10px;
  flex: 1;
}

search-sidebar.component.html

<div style="padding: 10px">
  <label class="sr-only" for="processName">Process Name</label>
  <div class="input-group mb-2 mr-sm-2 mb-sm-0">
    <div class="input-group-addon">
      <md-icon>search</md-icon>
    </div>
    <input type="text" [(ngModel)]="searchValue" class="form-control" id="processName" placeholder="Process Name">
  </div>
  <md-grid-list cols="1" rowHeight="40px" style="margin-top: 5px; overflow: scroll">
    <md-grid-tile *ngFor="let item of items | listFilter:searchValue" colspan="1" rowspan="1">
      <button md-raised-button [color]="isSelected(item) ? 'primary' : ''" class="process-name" (click)="changeSelected(item)">
        {{item}}
      </button>
    </md-grid-tile>
  </md-grid-list>
</div>

search-sidebar.component.css

.process-name {
    width: 100%;
    color: white;
    text-align: center;
    border-radius: 4px;
}

md-grid-list {
    min-height: calc(100% - 24px);
    max-height: calc(100% - 24px);
}

Answer №1

md-grid-list::-webkit-scrollbar {
  width: 0px;
  height: 0px;
}

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

Maximizing efficiency in website reloading and development with Sinatra using Ruby along with Rack and Haml

In my efforts to build a Sinatra website, I have gone from using Shotgun to now utilizing Rerun for reloading my Thin server whenever I make file edits. However, the development cycle is proving to be quite time-consuming. Even small changes to CSS, JavaS ...

Troubleshooting Problem with Uploading Several Photos to Firebase Storage

I need assistance with uploading multiple photos to Firebase Storage. Despite my efforts, it seems that the original upload keeps getting overwritten and the folder with the venueID property is not being created. Can someone provide some guidance on this i ...

Methods for hiding and showing elements within an ngFor iteration?

I am working on an ngFor loop to display content in a single line, with the option to expand the card when clicked. The goal is to only show the first three items initially and hide the rest until the "show more" button is clicked. let fruits = [apple, o ...

The "Read more" feature is not functional on mobile devices

I am encountering issues with my Wordpress blog on mobile screens. The "read more" button is not functioning, and the screen size does not fit properly on mobile devices. Visit abood250.com for more information. CSS Styling: /* =Global ----------------- ...

When scrolling, the menu is being overlapped by the Carousel in HTML5, CSS3, and

I am currently working on a One Page HTML webpage that needs to be responsive, and the requirement is to use Bootstrap. I have gone through all the tags but can't seem to identify the issue. One problem I encountered is that when I scroll down the pa ...

What is the process for choosing a specific id from a JSON structure?

Is there a way to extract specific data from a JSON format within an Ionic project? What is the process for selecting the ID associated with particular data in a JSON format? And how can I retrieve and display the value linked to the selected product&apos ...

Deploying an Angular 2 application using SystemJS and Gulp can sometimes feel cumbersome due to its

Although I have experience developing with Angular, I recently started working with Angular 2. After completing the quickstarter tutorial, I attempted to deploy the finished application on a server in production mode. My lack of experience with SystemJS a ...

Decorators do not allow function calls, yet the call to 'CountdownTimerModule' was executed

While building production files, the aot process is failing with this error message: Function calls are not supported in decorators but 'CountdownTimerModule' was called. I run the build command using npm run build -- --prod --aot and encounter ...

The radio button in Angular 6 is not selected

Below is a code snippet that I am working with: <div class="col-md-6 col-lg-6 col-xl-6 mb-5"> <label>Versioning</label><br/> <div class="form-check form-check-inline"> <input class="form-check-input" type="radio" n ...

React application with a layout design that adjusts and responds to various

One task is to display various components based on the device's width; Two possible approaches have been considered: Create a React Component that accepts multiple components for different widths (sm, md, xl). It will automatically determine the de ...

How to use jQuery to change the background color of HTML table cells based on their content value

A dynamic table will be displayed based on the dropdown element selected. Below is a snippet of the code: <table id="myPlaneTable" class="table table-bordered"> <tr> <td style="width: 20%">Max speed</td> <td ...

What are some ways to prevent Bootstrap cards with images from stretching too far and creating additional white space?

My bootstrap cards are stretching too tall when I include images. Is there a way to prevent this overextension? https://i.sstatic.net/HEaYh.png https://i.sstatic.net/21DVq.png ...

How can you set a value to a radio button with Angular 4?

How can I set the JSON value for the radio buttons (Unlimited, Custom) below? I tried using [(ngModel)]="user.accessSchedule.fullAccess", but it's not working. <ol-radio-group [selected]="unlimitedAccessSchedule" id="accessSchedule" [(ngModel)]=" ...

What is the best way to align an image to flex-end?

I recently started using React and ran into issues trying to align my image using CSS. Despite trying various methods like justifyContent, justifySelf, and floating right, I couldn't get the image to align on the right side of the screen without resor ...

Include an additional Div tag in the existing row

I've been attempting to include an additional div, but it consistently appears as the second row.. I want all of them to be on the same row and aligned with each other. Here is the HTML code: <div class="content-grids"> <div clas ...

There was an error while compiling the Angular application using ng serve and ng build. The error occurred in the module build and seemed to be related to the Sass loader. The specific issue was an expected "}" that was

After experimenting with various nodejs versions and npm using nvm, attempting to downgrade/upgrade ng core and ng cli, trying to install sass-node and removing sass (and vice versa), I have exhausted all options. Despite searching through numerous Stack ...

Generate an additional CSS animation to display before the next page is loaded

When loading a page, I am implementing CSS transitions to display animated lines. To activate these lines, I am utilizing a jQuery script to change the class on the line elements. I am looking to reverse the CSS transitions when transitioning to the next ...

How to retrieve a Typescript variable within an ngIf conditional statement in Angular

How can I access a TypeScript variable inside an ngIf statement? TS: public data: string; HTML: <td> <div *ngIf="data === 'BALL' ; else noplay" >{{ play }}</div> <ng-template #noplay> {{ gotohome ...

Arranging Bootstrap 4 rows and columns in a vertical stack rather than horizontally

For some reason, I can't seem to get my .temp and .city divs to display side by side - they just keep stacking vertically. I've messed around with the column sizes but nothing seems to work. Any suggestions? <div class="col-lg" id ...

Having trouble with Floating Labels in Bootstrap 5

Having trouble with my floating labels - any advice? https://i.sstatic.net/fk0CG.png Here is the code snippet: <div class="form-floating mb-3"> <input type="text" class="form-control" autofocus id="txtNome" placeholder=" "> <la ...