Creating a vertical scrollbar with CSS flexbox for columns set at 100% height in a row for FF, IE, and

I am currently working on an HTML application that needs to fit perfectly within a designated space without causing any page level scrollbars. I have utilized flexbox styles extensively to achieve this, but unfortunately, I am facing compatibility issues with the latest versions of IE/EDGE and FF (Chrome is working fine).

Here are the specific requirements:

  • The layout should consist of 2 columns
  • The left-hand side (LHS) column must occupy 100% of the available vertical space and display a vertical scrollbar when the content exceeds its height.
  • The right-hand side (RHS) column should take up 100% of the available space both vertically and horizontally (which I have successfully implemented)
  • Both LHS and RHS columns cannot use "position:absolute" styles (due to performance problems in FF when rendering HighCharts inside containers with flexible and absolute positioning), nor can they have explicit pixel heights/widths (as the design needs to be responsive).

I have created a fiddle to illustrate the issue specifically seen in FF/IE/EDGE - the appearance of page-level scrollbars caused by the content in the LHS column. Chrome, however, behaves as expected.

http://jsfiddle.net/jzo56zzg/

HTML

<div class="wrap">
    <div>
        SOME 3RD PARTY ELEMENTS HERE
    </div>
    <div class="main">
        <div class="row">
            <div class="left">
                <p>lots of content</p>
                <p>lots of content</p>
                // enough content to be higher then app's allowed height
            </div>
            <div class="right">
                right
            </div>
        </div>
    </div>
</div>

CSS

html,
body {
  height: 100%;
}

.wrap {
  height: 100%;
  display: flex;
  flex-direction: column;
  background: red;
}

.main {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: yellow;
}

.row {
  flex: 1;
  display: flex;
  background: blue;
}

.left {
  overflow-y: scroll;
  background: green;
}

.right {
  flex: 1;
  background: pink;
}

Does anyone have a solution to achieve this seemingly straightforward design while adhering to the specified requirements?

Answer №1

Check out this example on the fiddle to see the desired outcome:

https://jsfiddle.net/sarahrivers/pxkwejtn/

Calculating heights can be a bit tricky, but here are the key components of my solution:

.row:last-child {
    flex: 0 1 auto;
    overflow: hidden;
}

and

.column {
    overflow-y: auto;
    max-height: 100%;
}

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

Saving information to a hidden div using jStorage

Currently, I am utilizing jStorage for storing data in local storage. When I store the data using console.log() and later retrieve it using $.jStorage.get(), I found that the values are not being assigned to the hidden div. Can someone provide guidance o ...

Ways to identify a disconnected RTCPeerConnection

Currently, I am exploring a WebRTC demo on my Chrome browser and have successfully set up a video conference. However, I am facing an issue when one of the peers disconnects, such as refreshing the browser. I am unsure how to detect this disconnection on t ...

Customize the printing settings within bootstrap by modifying the background color from transparent to a solid color using CSS/SCSS

I am facing an issue with the bootstrap CSS/print feature. In the bootstrap CSS (reset.css) file, all styles are cleared for printing purposes. @media print { * { text-shadow: none !important; color: black !important; background: transparen ...

Iterate through HTML content and utilize JavaScript along with Regular Expressions to substitute specific strings

In my HTML located in Anki, I have the following structure: <p>[!Quote] Title of callout 1<br>Content of callout 1</p> <p>[!Quote] Title of callout 2<br>Content of callout 2</p> <p>[!Quote] Title of callout 3<br ...

Can a webpage be sent to a particular Chromecast device without using the extension through programming?

My organization has strategically placed multiple Chromecasts across our facility, each dedicated to displaying a different webpage based on its location. Within my database, I maintain a record of the Chromecast names and their corresponding URLs. These d ...

"Adjusting the height of a div element while considering the

I have 2 elements with different heights and I want to make them equal: var highestEl = $('#secondElement').height(); $('.element').first().height(highestEl); I understand that the second element is always taller than the first one. W ...

Retrieving Table Cell Values Using Jquery: A Step-by-Step Guide

<table class="table" align="center" id="tblMain"> <tr> <td>Status</td> <td><b><span name="current" value="Dispatch">Dispatch</span></b></td> </tr> </table> JS $(&apos ...

I attempted to pull information from the database and display it in my checkboxes. However, I encountered an issue where I am unable to save the selected checkboxes back to the database

This code snippet is written in Blade for a reservation form: <div class="col-lg-6"> <div class="contact-form"> <form id="contact" action="{{url('/reservatio ...

The functionality of the disabled button is malfunctioning in the Angular 6 framework

Just starting out with angular 6 and I'm using formControl instead of FormGroup for business reasons. app.component.html <button class="col-sm-12" [disabled]="comittee_Member_Name.invalid && comittee_Member_Number.invalid && c ...

What is the best way to connect to a specific part of a webpage that functions properly on Safari?

On my website, I have a testimonials page with a featured testimonial on the homepage that has a "Read More" option. When users click on this link, I want them to be taken directly to the testimonials page and to the specific section where that particular ...

The checkbox appears unchecked, yet the content normally associated with a checked checkbox is still visible

As the title suggests, I am encountering an issue with my code. Here is the snippet: $('#somediv').change(function() { if(this.checked) { $('.leaflet-marker-pane').show(1); } else { $('.leaflet-marker-p ...

Stop cascading styles when using nested rules in LESS to prevent unintended style application

In the process of developing a sophisticated front-end system using plugins, we are exploring different methods for composing CSS rules. Currently, we are considering two main approaches: Including parents in the class name Nesting parents in the selecto ...

Bootstrap 5's ScrollSpy functionality seems to be malfunctioning

I attempted to implement the scroll-spy feature of Bootstrap 5 in order to highlight the corresponding navbar item as active while scrolling through different sections of my HTML page. However, I encountered an issue where the navigation-link item would be ...

Changing the appearance of a website by switching CSS stylesheets according to the size of the browser

Trying to build two versions of my website: one for mobile devices or small browsing windows, and another for large browser windows. Looking to link HTML to different style sheets based on browser size. Current attempt in code only addresses total screen ...

Is using CSS as an HTML attribute considered poor practice?

I've been noticing an increasing trend of combining HTML, CSS, and JavaScript together in web development. However, I was taught to keep them separate with HTML linking to the sources/scripts. While using the style attribute in HTML is sometimes acce ...

Is there a way to gather information from a web service and neatly display it within an HTML table?

Is it possible to fetch a JSON array from a web service and save it in a variable? Consider the following table structure: <table id="myTable" border="1"></table> The table is populated using the code below: // JSON array var myData = metho ...

The mysterious case of the vanishing close button on Curator.io's mobile

Currently, I am using curator.io aggregator to showcase my Instagram feed on the website. An issue arises when switching to mobile view as the close button (class="crt-close") disappears. You can see an example of this here: To replicate the pr ...

Creating a Form with HTML and CSS

I am currently working on setting up a banner that includes an overlay with a cutout. Beneath the overlay, there is an image. My goal is to create this design using HTML and CSS. I have been experimenting with pseudo-elements but I am having difficulty re ...

Is it possible to include spaces in a JavaScript alert message?

Is it possible to add spaces in an alert message? I have been trying to include spaces in my alert messages, but the alerts do not appear when there are spaces. Example where it works: https://jsfiddle.net/yczrhztg/ Example where it doesn't work: ht ...

When the browser width is reduced, the text appears outside of the image

When pasting text into an image in this example, everything looks fine at first. However, as the browser width is reduced, the text starts slipping out of the picture. To make matters worse, unsightly line breaks are also added. Is there a way to prevent ...