Cause a bootstrap column to have overflowing content rather than expanding

I've searched extensively for the solution to my problem, but haven't found a satisfactory answer yet.

My goal is to create a location finder with a map on the right and a list on the left. With over 18,000 locations to search through, the list could be long. It doesn't make sense for it to extend beyond the size of the map on the right.

This is the layout I have in mind:

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

To ensure responsiveness, I want the columns' height in the second row to be set as a percentage rather than a fixed pixel amount. While I'm not overly concerned about the map's height on the right (as it will adjust responsively), I am struggling with getting the list on the left to overflow instead of just expanding endlessly.

I've experimented with applying different sizing classes with the overflow-auto property to the column. I've also tried wrapping the column's content in another div and applying these classes, without success.

The closest I came was getting the column's contents to overflow with a scroll bar, but the parent div retained its original height, resulting in significant empty space below the row.

This whole situation is driving me crazy! I find it hard to believe that achieving this seemingly simple layout is so challenging. The sizing classes examples appear to provide what I need, but they don't work when implemented.

Currently, my code looks like this: https://codepen.io/zachattack05/pen/aeLmmv

--------------------------- UPDATE ---------------------------

Following Zim's recommendation, the page now displays the scrollbar correctly, but it seems larger than the expected 25%.

Here's a full-size screenshot showing the result. Despite setting h-25, the row appears to take up at least 75% of the screen.

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

A more accurate representation of what I envision is something similar to this image, although not to scale. The map area should occupy 25% of the page's height, nestled between other rows and a footer at the bottom. I don't want the map and scrolling section to stretch all the way down the screen, as that would be too tall.

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

Answer №1

There have been previous inquiries on this topic. Flexbox items are designed to have equal heights and will adjust to the height of the tallest column. If you wish to restrict the height of one column in order for the other to be scrollable, consider using an inner position:absolute element...

<div id="PanelLocationFinderContent" class="row flex-grow-1 position-relative">
    <div id="locationlist" class="col-sm-4 overflow-auto bg-info">
        <div class="position-absolute">
            <p>text</p>
            <p>text</p>
            ..
            <p>text</p>
            <p>text</p>
        </div>
    </div>
    <div class="col-sm-8 bg-warning">
        <div class="embed-responsive position-static">
            <div class="embed-responsive-item embed-responsive-1by1 bg-secondary">
                <div id="map" class="bg-success h-100">MAP CONTENT WILL BE HERE</div>
            </div>
        </div>
    </div>
</div>

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 delete a CSS class from an element?

Is there a way to remove the "ui-widget-content" class from the code below? It appears in multiple places throughout my code. Here is an example snippet: <pre> <form id="clientForm"> <div id="clientData"> <div id="gbox_grid_1" class=" ...

How come the margin-bottom is displaying as the margin-top?

When I attempt to add margin-bottom on a div inside its parent, it seems to display as the parent's margin-top. Why is that? HTML: <div id="wrapper"> <div id="content"> <div id="box"></div> </div> </d ...

Tips for incorporating the numerous values of a one-to-many relationship into an HTML template using Django

I am facing an issue with a one-to-many relationship in my Django project. Here is how it is structured: class Listing(models.Model): title = models.CharField(max_length=60) class Images(models.Model): listing = models.ForeignKey(Listing, on_delet ...

I'm having trouble with the margin-right property in my HTML code. What's the best way to align my content

Currently, I have been delving into the world of Responsive Design. However, I am encountering some difficulties in positioning my content centrally when the screen size increases. The issue is as follows: @media screen and (min-width: 950px) { body ...

How to position items at specific coordinates in a dropdown using JavaScript

I have five images in my code and I would like to arrange them in a circular pattern when they are dropped into the designated area. For example, instead of lining up the five images in a straight line, I want them to form a circle shape once dropped. Ho ...

@keyframes shimmering-fade

I'm attempting to create a text animation effect (please see video) but I'm struggling to find the solution!! Can someone assist me with this? Should I use JavaScript for a better result? h1.fadeinone { animation: fadeinone 10s;} h1.fadeintwo ...

Extracting data from a JQGrid in HTML5 Builder: a beginner's guide

Apologies for asking this question as I couldn't find any relevant posts addressing it specifically in relation to HTML5 builder. I am trying to retrieve the value of the "ID" column, which happens to be the last column among the four, based on the r ...

Preserving spacing using minimum widths

Looking for some help with a page layout issue. I have a header on my page with a title and menu. Currently, the header has a margin and a minimum width set to the width of the menu. However, when the user resizes the window and reaches the minimum width, ...

Move your cursor over X or Y to alter the color of Y exclusively

I am currently designing a navigation bar that includes icons followed by the title of their respective pages (for example, an icon of a home followed by the text 'Home'). I would like to change the color of only(!) the icon from black (default) ...

Displaying a loading spinner image as PHP script runs

Hey there! I've been experimenting with using a script to show a loading bar while my PHP code is running. I followed the instructions on this website, but even after following the exact steps, my loading bar still isn't showing up. Any suggestio ...

Eliminate Bootstrap's validation glyphs

Issue Description I am attempting to eliminate the validation icons from Bootstrap, such as the "x" and "check" symbols. Despite my efforts to search thoroughly, I have been unable to locate where these icons are located in the code. Code Sample You can ...

Bootstrap has been successfully installed and is functioning properly; however, the custom styling does not seem to be

After successfully installing bootstrap and JavaScript through NPM in my Laravel 6 project, I have noticed that the bootstrap is functioning properly on my website. However, I encountered an issue when trying to add custom styles in the resources/sass/ap ...

In the production and development environments, the interpretation of CSS classnames is being rearranged

Currently utilizing create-react-app v2. I've encountered an issue with a component that has multiple classnames: "x15 x14 login-form__field". Strangely, in the production build, the order of '.x14' and 'login-form__field' seems t ...

Issues with jQuery causing responsive CSS triangles to fail implementations

Recently, I stumbled upon the interesting concept of CSS triangles created using element borders. I decided to incorporate this design into one of my custom Wordpress themes, but I encountered a problem. I wanted to add a triangle at the bottom of a div, l ...

How can I achieve the functionality of an image changing when clicked and going back to its original state upon release with the help of HTML

I am facing an issue with styling an element to look like a button and function as a clickable link. My goal is to create a visual effect of a pressed button when it is clicked, while also loading the target page. For reference, here is a (non-working) J ...

How can I ensure the carousel stays centered on a webpage even after resizing the browser window?

Currently in the process of developing a website, I have implemented a jquery-based carousel on the homepage sourced from here. However, substantial modifications were made to tailor its appearance specifically for the site. The issue at hand is that I hav ...

Transfer the file image stored in a MySQL database to an excel spreadsheet

Having an issue with capturing image data input from a PHP and HTML database to Excel. I am trying to display the images in a specific size within an Excel file. Below is the PHP code used to create the table: <?php header("Content-type: application/o ...

Ensure that when a user clicks back on an image popup, the page stays in its current position

Is there a way to ensure that after closing a popup image, the browser returns to the same position where it was before? Currently, when I close the popup image, the page scrolls back to the top (as indicated by the red square in the example). However, I ...

The concealed [hidden] attribute in Angular2 triggers the display of the element after a brief delay

I am currently utilizing the [hidden] attribute within my application to conceal certain elements based on a specific condition. The situation is such that I have two divs - one for displaying results and another for showing the text "No results". Both t ...

Using Vue3 to conditionally display a child div based on the class of its parent div

Just starting out with Vue, I'm currently experimenting with the active classes feature from this Vue3 carousel plugin. My goal is to only show the text and link divs for the carousel__slide--active class, but at the moment, all carousel__items are di ...