Determine the highest position of itself by using the calculation: 100% viewport height minus y

I'm looking to make an element fill all the space below it until the bottom of the browser window. Is there a way to determine the y offset of the element in order to achieve this? I need help defining y:

.occupy-space-below {
    max-height: calc(100vh - y);
}

Answer №1

Instead of relying on calc with an unknown height for the upper element, consider using the power of flexbox

/*QuickReset*/ *{margin:0;box-sizing:border-box;} html,body{height:100%;font:14px/1.4 sans-serif;}

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

.grow{
  flex: 1;
  background: gold;
}
<div class="flex-column">

  <div>
    I<br>have <br>unknown<br>height
  </div>

  <div class="grow">
    occupy space below
  </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

What is the method to have text added automatically to an input field when a key is pressed?

Within my navigation, I have implemented a "full-screen overlay search box". When users click on the magnifying glass icon, a full-screen overlay with a search input field appears. You can see an example image here: . Currently, to enter text in this full ...

Open area following the initial words in a written passage

Can someone help me create some extra space after the first part of a text? The code below isn't achieving what I need, but it should give you an idea of what I'm aiming for. One issue is that the span tag needs to be changed to display:block. Ho ...

Struggles working with css in react applications

Looking for some assistance here... In the code snippet below, I have two separate elements that I want to display one at a time. The first element is an iframe and the second is a div. The idea is that if the user clicks on the {title}, the frame disap ...

Sorting a dynamic menu to assign custom classes with PHP

<?php // Select all entries from the menu table $sql1 = $pardConfig->prepare("SELECT id, menu_title, menu_link, parent FROM pard_menu ORDER BY parent, sort, menu_title"); // Create a multidimensional array to conatin a list of items and parents $sql1 ...

Having trouble with the css style of my asp:Button, looking to replicate the precise css of my a.button class

Struggling with applying styles to an asp:button? Despite reading multiple posts, I can't seem to make it work for my situation. My css setup for href tags looks like this: a.button { padding:6px;background:#4A6491;color:#FFF; border-radius: 10px 10 ...

What could be causing the overflow of the div element within my header?

I recently embarked on a personal project to create my own portfolio website using HTML, CSS, and JavaScript. As I was working on styling the header section with bright colors for visualization purposes, I encountered an issue where the green box was overf ...

Designing websites or applications for mobile devices requires careful consideration of how content will

Currently, I am trying to use media queries to cater to mobile screens. The main problem I am encountering involves the text on the header when switching between Portrait and Landscape modes. In the landscape view, the top property overrides the portrait ...

Issues with CSS Styling not being applied properly on mobile devices in a React App deployed on Heroku

The Dilemma My React app is deployed on Heroku using create-react-app for bundling. The backend is a Node.js written in Typescript with node version 10.15.3. Locally, when I run the site using npm start, everything works perfectly. However, when I view t ...

``I'm experiencing an issue with the Bootstrap 4 accordion where it is only functioning properly for the

<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-beta.3/css/bootstrap.min.css"> <script src="https://maxcdn.bootstrapc ...

Having difficulty linking a subclass in HTML with CSS

<div class="section-3"> <div class="section-3a"> <div class="section-3a(a)"> <p>light background color (header and sidebar)</p> </div> <div class="section-3a(b)"> <p>#FFFFFF</p> ...

The Power of HTML Floating Elements

<nav> <div class="row"> <img src="resources/img/logo-white.png" alt="logo" class="logo"> <ul class="main-nav"> <li><a href="#">Food delivery</a></li> <li ...

Can one utilize Javascript to write in plain text format?

Currently, using JavaScript I have a plain text containing data that is displayed within my form tags. Everything is functioning correctly, but now I need to update the values inside the code of my form tags in order for the changes to also be reflected in ...

Is the textarea's shape out of the ordinary?

Most textareas are typically rectangular or square in shape, similar to this: However, I am interested in having a custom-shaped textarea, like the example below: Is it feasible to achieve? ...

Transform the appearance of a complex image by altering its color using CSS

In my quest to bring a unique functionality to life, I am looking to achieve the following: I want to layer two transparent images within a <div>: one representing an object and the other depicting a glowing effect around the object. When hovering ...

Users who are utilizing Internet Explorer are unable to complete the search input field on my website

Hello, I am in the process of creating a website that frequently uses lengthy search terms. To optimize user experience, I have implemented a dropdown search bar inspired by the bootsnipp example below. While I have applied some custom styling to the desig ...

Position SVG's in relation to one another

I have two SVG's and I'm looking to position the second SVG in the top right corner of the first SVG. In this example, I want to place the exclamation SVG in the TOP RIGHT corner of the first SVG. Can someone provide guidance on what changes I n ...

Ensure that the child element completely obscures the parent element

My goal is to have an image fill its parent element completely. <div class="parent"> <img src="image.jpg"> </div> If I use the following CSS: img{ width: 100%; } The image will only fill the parent horizontally, leaving empty s ...

`flex display is not responsive to justify and align content and items properly`

I'm facing an issue with aligning the .contact and .subscription divs in the footer. While the .contact div justifies itself at flex-start, the .subscription div isn't justifying at the flex-end as expected. I've tried using justify-con ...

Error in content policy for CSS in Stripe Checkout

I am currently attempting to integrate Stripe Checkout into my Ionic App. I have created a Directive that injects the form into my content view, however, upon execution, the CSS fails due to a content policy violation: checkout.js:2Refused to load the s ...

Avoiding the collapse of the Bootstrap 4 navbar

Having trouble with the navbar collapsing on itself? The issue seems to occur around 1280px window size, but works fine when the window is wider or narrower. https://www.bootply.com/AcsaaqReAL .navbar-custom { background-color: #333333; border- ...