Enable vertical overflow to adjust automatically without needing to set a specific height

I have a unique table that consists of 3 main parts:

  • the header
  • the content
  • the footer

Using flexbox, I managed to make the "content" section occupy all available view height. However, this was not explicitly done and now when there are too many items in the "content," the page expands instead of the "content" section overflowing.

My goal is for the "content" to still utilize the available view height without causing the page to overflow but instead create a scrollable area within the "content" section.

Here is the code snippet for the content section:

<code>

<div class="flex flex-col flex-1 text-sm text-[#707070] overflow-scroll" :class="csvData ? '' : 'justify-center items-center'">

<!-- Table body -->
    <div v-if="csvData" v-for="(row, index) in filteredData" :key="index" class="grid items-center gap-4 px-2 py-4 grid-cols-[auto,1fr,1fr,1fr] sm:grid-cols-[auto,1fr,1fr,1fr,1fr] md:grid-cols-[auto,1fr,1fr,1fr,1fr,1fr]">
        <input @click="toggleRow(index)" :disabled=" enableEditMode ? true : false" type="checkbox" v-model="selectedRows[index]">
        <span>Unassigned</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " >{{ row.editedData[0] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " >{{ row.editedData[1] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " class="hidden md:block" >{{ row.editedData[2] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " class="hidden sm:block" >{{ row.editedData[3] }}</span>
    </div>
</div>

</code>

A scrollable area will be generated within the content section without causing the page to overflow.

Currently, as shown here, the page overflows and does not display the footer.

Answer №1

Give this code a try

<div class="flex flex-col flex-1 text-sm text-[#707070]">
<!-- Displaying Table Content -->
<div class="overflow-auto">
    <div v-if="csvData" v-for="(row, index) in filteredData" :key="index" class="grid items-center gap-4 px-2 py-4 grid-cols-[auto,1fr,1fr,1fr] sm:grid-cols-[auto,1fr,1fr,1fr,1fr] md:grid-cols-[auto,1fr,1fr,1fr,1fr,1fr]">
        <input @click="toggleRow(index)" :disabled="enableEditMode ? true : false" type="checkbox" v-model="selectedRows[index]">
        <span>Unassigned</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' ">{{ row.editedData[0] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' ">{{ row.editedData[1] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " class="hidden md:block">{{ row.editedData[2] }}</span>
        <span role="textbox" :class="row.editMode ? 'border p-1 border-dashed border-[#606069]' : '' " class="hidden sm:block">{{ row.editedData[3] }}</span>
    </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

Revealing information about a photo when hovering over it

I am currently working on a project where I need to display images from a database in two columns. My goal is to have additional details about each image, such as the country and year it was taken, appear when I hover over them. A good example of what I&ap ...

What is the best way to add a border around an image along with a button using VueJS?

I am struggling to link a button and an image in VueJS to display a border around the picture. While I can successfully display the border on the button, I am unsure how to extend it to the image as well. Vue.component('my-button', 'my-img& ...

What is the most effective method for locating and capturing a specific element (such as an input box) in Python Selenium using either Xpath or CSS selector

I am currently using selenium to scrape a website, primarily relying on xpath or CSS selectors to extract elements. However, I have noticed that these selectors are dynamic, which contradicts what I have read online about CSS selectors being stable. As a b ...

Unable to position a div alongside a fluid div with minimum and maximum widths

Within this container, there is a div. #leftBanner { height: 100%; background-color: #CCC; width: 22%; min-width: 245px; max-width: 355px; float: left; } This particular div doesn't cooperate when I try to float another div next to it. While I could ...

Enhancing Tabulator tooltips with custom CSS styles

Is there a way to style the tooltips that appear when hovering over cells in my Tabulator table? When I set tooltips:true, Tabulator adds a title tag, but applying CSS inline has been tricky. So far, I have tried: div[title]:hover:after { content:attr( ...

Having difficulty aligning an image vertically within a table cell

I am facing an issue with aligning images in table cells. Specifically, I have four table cells and want to vertically align a smaller image at the top of its cell. Despite trying to use vertical-align:top for the image within the cell, it doesn't see ...

Is the background color not being implemented?

I'm struggling with an issue - I can't seem to apply a background color to my top bar. I've tried multiple times but it's still not working. Could you please help me fix this error? https://i.sstatic.net/mzJIo.png Below is the code fo ...

What is the best way to ensure that my pictures are only visible within a modal box?

I've set up a modal box called sectors with two subcategories: publication and food. Each subcategory is linked to a div that contains an image. My goal is to hide the image inside the modal box and display it on the screen once the box is closed. ...

CSS - Utilize floating divs to dynamically populate empty spaces

I am currently working on creating a grid layout on my website, . Despite using multiple divs (images) with the float: left; property, I am noticing empty spaces and gaps that are not being filled by the floating divs. Thank you in advance for any assist ...

Why isn't Google Map showing up in my HTML <div> section?

I am currently working on a web page that consists of two containers. The mainmapdiv container covers the entire page, while the mainhomediv container is positioned on top of the mainmapdiv. My goal is to hide the mainhomediv container and show a Google Ma ...

Adjust the transparency of an image within an overlay when clicked on the overlay

Having an overlay on a Google map with two images contained within it, I am looking to adjust the opacity of the images when a user clicks on the overlay or on top of an image within the overlay. I attempted to utilize domlistener, but it did not yield the ...

Can Javascript be used to identify the number of td elements in a table and specify column widths within the table tags?

Is there a way to automatically add the "col width" tag based on the number of td tags within a Table tag? For example, if there are 2 td's, then it should add 2 "col width", and if there are 3 then, 3 "col width", and so on. <!DOCTYPE html> &l ...

Adjust the size of the image as needed in order to fit within a container of fixed

Is there a clever way to use CSS and/or JavaScript/jQuery to adjust the size of images only when necessary for them to fit within a fixed-height container alongside the remaining content? Upon reviewing the images in the 'new this week' and &apos ...

What is the best way to selectively add multiple classes to a single Material UI classes attribute based on certain conditions?

I am trying to use the Material UI Drawer and wish to add a class named "paperStyle" to the classes prop with the rule name "paper" and then, under certain conditions, apply an additional class called "specialPaperStyle" for specific users. However, I have ...

Avian-themed masking feature for jCarousel

Currently, I have a series of images in constant motion using jCarousel. Only one image is visible fully at any given time, and I am looking to create a "feathering" effect on the edges of the carousel so that the images smoothly fade in and out as they co ...

Adjusting the size of HTML checkboxes for creating PDF documents

Currently facing a dilemma. When it comes to resizing checkboxes in HTML, the common recommendation is to use JavaScript to prompt the browser to adjust the size of the elements. However, in our scenario, we rely on wkhtmltopdf, a command line tool that u ...

Injecting a full browser-screen DIV into the body of the webpage

Recently, I was tasked with developing a script that could be utilized on any website. As a test, I decided to use the Google search results page. My goal is simple - to have a full-screen semi-transparent div displayed on any site for cookie notification ...

Dimensions in Material UI

As I embark on my journey with Material UI components for React, I am facing the challenge of integrating pre-styled components into my project. I have noticed that some components appear too large in my layout due to excessive padding and margins. Curren ...

What is the best way to make hyperlinks in impress.js?

Wanting to craft a visually stunning brochure for my client with the help of impress.js. I want to include a link on each slide that directs to the relevant page when clicked. Is it feasible to have a clickable link to each slide on every page as well? ...

Utilizing jQuery to dynamically update the selected item on a navigation bar

I have created a menu bar using the following HTML code: <ul id="menu-bar"> <li class="active"><a href="/" id="home">Home</a></li> <li><a href="/Club/" id="club">Club Quarter</a></li> <l ...