Ensure the main page occupies the entire screen without the need for scrolling

Can someone help me with my Vue app? I need to figure out how to make the start page full screen without any scroll bars in the main window at any scale. The scrollbar should be located within "div class="bottom-center".

<script setup>
import Comp from './Comp.vue';
</script>
<template>
  <div class="root">
    <div style="font-size:30px">menu</div>
    <Comp></Comp>
  </div>
</template>
<style>
body {
  box-sizing: border-box;
  margin: 0;
}
.root  {
  display: flex;
  flex-direction: column;
}
</style>

Comp.vue

<template>
  <div class="container">
    <div class="top-left" style="background:red">top-left</div>
    <div class="top-center" style="background:blue">top-center</div>
    <div class="top-right" style="background:green">top-right</div>
    <div class="bottom-left" style="background:yellow">bottom-left</div>
    <div class="bottom-center" style="background:white;overflow-y:scroll">
      <div v-for="item in [1,2,3,4,5,6,7]" :key="item" style="height:150px">{{item}}</div>
    </div>
    <div class="bottom-right" style="background:grey">bottom-right</div>
  </div>
</template>
<style>
.container {
  display: grid;
  grid-template-columns: 5rem 18rem 1fr;
  grid-template-rows: 4rem 1fr;
  grid-area: 'top-left top-center top-right' 'bottom-left "bottom-center bottom-right';
}
</style>

Check out this Vue playground...

Answer №1

If you want to get rid of the scrollbar at 'bottom-center', simply delete the 'overflow-y: scroll' property

<div class="bottom-center" style="background:white;"></div>

To make the div container expand to fill the entire page height, adjust the height of the div to 100vh (or another value based on other page elements). Remember to also remove any fixed height set on the div-element within the bottom-center div.

<div v-for="item in [1,2,3,4,5,6,7]" :key="item">{{item}}</div>

Learn more about Viewport-percentage Lengths here: https://www.w3.org/TR/css3-values/#viewport-relative-lengths

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

What is the best way to align the middle element of a flex row in the center?

Desired Outcome: I have three elements within a container styled with display: flex. My goal is to align the left item to the left, the right item to the right, and have the middle item centered. space-between does not achieve this look due to the varyin ...

Is the button not aligned properly with the email input field?

<div class="subscribe__form--action--btn"> <form action="mailto:<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="32545b5e5b5746545C5B5356477F54585850"> </a>" meth ...

Unable to achieve separation of borders within dash_table.DataTable styling using CSS by setting border-collapse: separate; considering using border-spacing instead

Is there a way to create space between the lines of a table in dash_table.DataTable using css or regular style capabilities? I have tried using border-collapse and border-spacing but it doesn't seem to be working. How can I achieve this desired spacin ...

Guide to configuring capybara-webkit for testing ajax requests and capturing screenshots containing HTML with loaded CSS and JavaScript

Having some trouble setting up capybara-webkit on my Rails 4.2.1 app. Tests are running fine, links are being clicked, and ajax calls are working, but there's one odd issue with capybara-screenshot gem. I wanted to capture html screenshots with all as ...

access older siblings, accordion animation

I need assistance achieving an accordion effect on a DIV when hovering over it. The right side of the accordion is functioning properly, but I am facing issues with the left side. You can view my code on jsFiddle Could someone please provide guidance on ...

Rebel Spirit on a Wordpress Platform

I've encountered a strange issue on my Wordpress blog. For some reason, the code "&nbsp" is being inserted right after the opening <body> tag. I have checked the header.php file and there is no instance of this code present there. It's ...

Approach to decoupling design elements from DOM interactions

Seeking recommendations or guidelines for effectively segregating classes utilized for browser styling and DOM manipulation. Specifically, we are developing a single-page app using backbone.js and heavily relying on jQuery for dynamically updating page el ...

Ensure prototype is easily accessible within vuex

Within my app.js file, I implemented a functionality to enable translation in Vue: Vue.prototype.trans = string => _.get(window.i18n, string); This feature works perfectly when used in my Vue files: {{ trans('translation.name') }} However, ...

Webpack encounters difficulty in mounting Vue components

Upon compiling a project using Webpack with Vue, an error arises when accessing a page containing a Vue component: [Vue warn]: Failed to mount component: template or render function not defined. Instead of the expected component, this is rendered by Vu ...

The spacing within the table's <tr> elements does not get altered

I am struggling to add a small space in the table <tr> but my attempts have not been successful. How can I resolve this issue? Please refer to the image below for clarification: https://i.sstatic.net/HXdhq.png .panel-booking .panel-body { pad ...

Jquery Error in Bootstrap and DataTables Integration

My knowledge of frontend coding is limited, so please bear with me. Initially, my website was using MVCContrib grid along with its own CSS style. Recently, I switched to Bootstrap which caused MVCContrib to stop working. I've been struggling to integ ...

What is the best way to trigger an event using vue-chartjs?

I am using vue js to display a graph with chartjs. I have implemented an onClick function on the graph to emit an event in the parent component and retrieve data. However, the event is not working as expected. Can you help me identify the issue? Component ...

What is the best way to add animation to my `<div>` elements when my website is first loaded?

I am looking for a way to enhance the appearance of my <div> contents when my website loads. They should gradually appear one after the other as the website loads. Additionally, the background image should load slowly due to being filtered by the wea ...

"Spin an image using Javascript when it is shown on the

I've got a script that shows an image when we are attacked by a monster. The image is initially set to display="none", but switches to display="" when a monster appears. What I'm looking to do is make the image rotate 360° when it changes from ...

Exploring the possibilities of toggling between a personalized CSS design and a Bootstrap CSS layout

Is it possible to implement a dropdown menu on my sample-page using javascript/jquery in order to switch between a custom layout and a bootstrap layout? ...

"Customizing the topbar of Twitter Bootstrap for right-to

Attempting to implement twitter bootstrap for a top navigation bar on my master page. http://jsfiddle.net/ZqCah/1/ Encountering some issues and seeking assistance: 1- Desiring to switch the direction of all content to right-to-left (rtl). This would me ...

Show the logo next to the user's login information

I've been grappling with this issue for quite some time now and I'm on the verge of giving up. What I'm attempting to accomplish is to have the logo display in a float-left position while also having the user welcome message displayed in fl ...

Creating a user-friendly form in a Nuxt/Vue application that enables dynamic attribute creation

I am currently working on designing a form that enables users to create different variations for a product within a Nuxt/Vue application. The goal is to provide users with the ability to specify attributes for each variation using a text field. These attr ...

Content being pushed upward by Bootstrap modal

I've spent the last few hours working with the bootstrap modal, but I'm encountering some issues. Despite my thorough search, I haven't found anyone facing a similar problem. Here is the structure of my modal: <!-- Modal --> <div ...

The Safari browser is plagued by a flickering issue with CSS perspective flip animations, even when using the back

I'm facing an issue with Safari (both desktop and iOS) related to a simple CSS flip animation. Despite searching through similar posts and answers, I haven't found a solution yet and am in need of a fresh perspective. Essentially, I am creating ...