Is there a way to enable scroll on v-col?

I'm working on a layout that has specific requirements:

  • The grey container should cover the entire viewport without exceeding it
  • The green v-row should occupy the grey container entirely
  • v-col 1 should utilize all available space and add a scrollbar if necessary
  • v-col 2 should fill the available space but shrink when needed
  • v-col 3 should always be at the bottom and only take up required space

https://i.sstatic.net/8fL53.png

Currently, I have the given setup. The issue is that '1' doesn't become scrollable and ends up pushing '2' and '3' off-screen. What am I missing here?

Bonus question: Is there a better way to make the container fill the viewport? Using 100% isn't working for me.

Even more bonus: Would achieving this be easier using regular divs instead of the current setup?

<template>
  <v-app>
    <v-container class="ma-0 pa-0 d-flex full-height">
      <v-row no-gutters class="d-flex flex-column flex-nowrap flex-1-0-100">
        <!-- column 1 -->
        <v-col class="overflow-y-auto flex-1-0">
          <v-list :items="dummy"></v-list>
        </v-col>

        <!-- column 2 -->
        <v-col class="d-flex justify-center flex-1-1-100">
          <v-btn color="primary">+</v-btn>
        </v-col>

        <!-- column 3 -->
        <v-col class="d-flex justify-center flex-0-1">
          <v-btn color="secondary">Close</v-btn>
        </v-col>
      </v-row>
    </v-container>
  </v-app>
</template>

<script setup>
  const length = 10 // Adjust for smaller/larger array
  const dummy = [...Array(length).keys()]
</script>

<style scoped>
  .full-height {
    height: calc(100vh - 37px);
  }
</style>

Answer №1

Based on my understanding, you are looking to evenly distribute any remaining space between columns 1 and 2. Column 1 should expand to fill as much available space as possible without exceeding the total. However, there are a couple of challenges:

  • Column 1 is set to have a fixed width and cannot shrink (flex-1-0). To make it flexible enough to shrink when necessary, it should be defined as flex-1-1.
  • The flex-basis of column 2 is currently set to take up 100% of the available space (flex-1-1-100), but it should only occupy the space left by column 1. Therefore, it should be adjusted to flex-1-1.

If you encounter issues with using v-row and v-col for a simple flex-column layout, consider using regular div elements instead. This approach may be more straightforward, especially since v-col comes with its own predefined flex behaviors that could potentially complicate your design. Here's an alternative playground utilizing div elements.

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

Exploring the Depths of Vue Router: Incorporating Dynamic Nested Routes

Hey everyone, I'm currently diving into working with the vue-router and Vuex Store. I'm facing a challenge where I have a route that consists of two dynamic parameters (:id, :templateId). My question is, what do I need to specify in my routes c ...

Enhancing Image Quality in Internet Explorer 10

Here is my current situation: I am working on a web page with a responsive design. The layout of the page consists of two vertical halves, and I intend to display an image (specifically a PDF page converted to PNG or JPG) on the right side. The challenge ...

The process of mounting a Vue component involves removing the surrounding div element

I am facing an issue while mounting a component on a function. Everything seems to be working fine initially. However, I have configured it to destroy the div after a certain number of seconds. The problem arises when I attempt to add the component again; ...

Enclose an <img> tag within a <span> element and use jQuery to assign a class to the <span>

I am trying to wrap a specific <img> tag with a <span> element and assign a class to the <span>. Below is the relevant code snippet: <img id="wrapped-image" alt="" src=""> Despite my efforts, the following code does not seem to w ...

Right-align the span and vertically align the header to the left

Seeking guidance on aligning a span to the right of a div, where the span is nested within a button. Although I have successfully achieved the above, I am encountering difficulties in vertically aligning the header while also keeping it to the left. .s ...

How to implement a for loop within a Vue.js method

Within Vuejs, I have a method that updates multiple variables based on user selection. methods: { updateChart(){ this.chart1.series[1].data = [this.$store.state.selectedcities[0].value[1]]; this.chart1.series[2].data = [this.$store.state.selecte ...

Optimize your code usage when incorporating vee-validate and the composition API in Vue.js 3 for maximum efficiency

After going through the composition api documentation for vee-validate, I was able to successfully set up validation on my forms by following the described pattern. However, I found myself writing a lot of code for each form, which made me uncomfortable a ...

Interactive CSS Video Gallery Slideshow

Is there a way to create a slideshow video gallery using CSS? I've looked everywhere but all I find are slideshow image galleries. If anyone has any resources or tips on how to do this, please share! This is the kind of video gallery I'm looking ...

Is there a way to consistently maintain a specific column size in Bootstrap?

I'm currently working on a website and running into an issue that I can't seem to resolve. The problem lies in the layout of multiple cards with information; they are arranged in columns and when there are more than 4 columns, they switch to a ne ...

Leveraging mdbvue within the SAFE Network, style elements are noticeable by their absence

I checked out this handy tutorial But what really caught my attention was this tutorial: After following along, I ended up with the result below: https://i.sstatic.net/asgZs.png It's clear that something is missing in terms of style. As a novice i ...

My div is becoming overly wide due to padding and margin issues

Looking at this div: <!------ CODE SNIPPET ------> <div id="content"> <div class="top"> I am cool<br /> I am cool<br /> I am cool<br /> I am cool<br /> </div> </div> <!------ /CODE SNIPP ...

Is there a way to add CSS styles to all div elements except for those that are contained within a parent div with a certain class

I have a universal CSS that impacts all div elements, but I need to exclude the divs within a parent div that has a specific class, like in this instance where it's the "should-not-apply" class. div { font-size: 20px !important; font-weight: 50 ...

Is there a way to assign the chosen option from a dropdown list to an input field in Vue 3?

I am working with a list that is returned from an API request. I have a text input field where I can search for items in the list, and the results are displayed dynamically as I type. My goal is to be able to select an option from the list and display the ...

Tips for creating a clickable A href link in the menu bar that triggers an accordion to open in the body when clicked - html

Is there a way to open the first accordion when clicking on the "open 1st accordion" link, and do the same for the second link? The accordions themselves work perfectly fine, I just need a way to trigger them from outside their scope by clicking on links i ...

Personalizing the design of Bootstrap

As a beginner in working with Bootstrap, I am currently focused on creating an index html page for an online shop. For reference, here is an example - https://jsfiddle.net/a393wtng/1/ Upon resizing the output frame, it becomes apparent that 4 products can ...

Only apply prevent default on specific levels for better control

I am currently working on a menu with submenus. I am facing an issue where when I click on a top-level menu item, I need to use prevent default because they are anchor tags. However, for the submenu items, I do not want to prevent default behavior. I am st ...

jQuery and CSS3 for importing and customizing text files

I successfully customized the file input utilizing jQuery and CSS3. However, there is one aspect I couldn't quite figure out. After the user selects an image or file, I want to display the selected file's text at the very bottom of the text like ...

Is there a way to alter the background image of the logo specifically for mobile device viewing?

Here is a snippet of my HTML code: <nav class="navbar navbar-expand-lg navbar-light bg-light"> <a class="navbar-brand" href="{{ route('home') }}"> <img src="{{ asset('assets/images/logo-school-icon.png') }}" ...

What are some creative ways to incorporate a variety of images into my website?

Currently working on a webpage and running into an issue. I have a div called "background" where I am loading several images using the <img>-tag. The problem is that the images are set to float:left;, causing them to wrap onto a new line as they can& ...

What is the best way to upload an image, pass it to my controller for validation, and finally store it in my database?

I am currently working on a project using Laravel 5.4 and Vue.js. I have a file named AddProduct.vue which contains a form. Everything in the form is working fine except for uploading an image. Can someone guide me on what onchange method I should use to u ...