Is there a way to style a div to have a specific minimum height while also keeping the child divs aligned at the top using CSS Grid?

Here is a mockup I created: [https://codepen.io/axlemax/pen/zYKWPge]

It resembles the basic layout of Twitter desktop: [https://twitter.com/home]

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

I am facing an issue with the "adcontainer" div (the one labeled as "what's happening" at the top). I want it to have a minimum height of 900px.

However, when I set the min-height to 900px, it affects the positioning of the 6 ad items within the div.

I tried different approaches like using "min-height: 900px" and changing "grid-template-rows: 15px auto;" to "grid-template-rows: 15px 900px;", but none of them worked as expected.

If anyone has a solution to this problem, I would greatly appreciate your help!

[Note: A Stack Snippet version is also available. However, I find the codepen version more user-friendly, but some users prefer Stack Snippets]

Your custom CSS code snippet here...
<html>
  <div class="container">

    <!-- Your HTML structure goes here -->

  </div>
</html>

Answer №1

apply the following style to adcontainer: "align-content: baseline;"

check out this useful cheatsheets link

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

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 ...

CSS Trick: Positioning All Div Children at the Bottom

I have been attempting to align all the children of a div to the bottom, but so far have not been successful. I tried using the display: table and table-cell method that I found online, as well as some other methods, but none seem to work for me. You can f ...

What are some creative ways to customize the appearance of a PHP email form body?

I need assistance in creating a PHP form that will generate an email with visually appealing formatting. Currently, when I receive the submitted form via email, it lacks aesthetic presentation. After implementing the following code snippet, this is how th ...

HTML5 - Adding Space to Main Section with a Two-column Layout

After spending 3 and a half hours racking my brain, I still can't figure out how to complete two seemingly simple tasks. First, I need to pad the outside of paragraph div, and secondly, I want to split the main section into two columns to add some lin ...

Customize a theme component only when it is a child of another component

I am trying to customize the CSS of MuiButton only when it is nested inside a MuiDialog. https://i.stack.imgur.com/13doLm.png In regular CSS, you could achieve this with: .MuiDialog-root .MuiButton-root { border: 5px solid blue; } However, I am strug ...

Creating a dynamic slideshow with automated arrow navigation is simpler than you may think

I have successfully tested the slideshow and it is functioning perfectly without any issues. I would like to have a dual slideshow setup (slideshow 1 and slideshow 2) with next and previous buttons, but I am interested in adding an automatic sliding featur ...

Create a JavaScript function to implement a fade-in effect without relying on

Here is the code snippet that I am working with: document.getElementById('showRtb').addEventListener('click', function () { document.getElementById('rtb').style.display="inline-table"; }); document.getElementById(&ap ...

Issues with table nesting functionality

I'm attempting to organize tables in a nested manner, instead of placing a table within each cell. My engineers have advised against simply styling the table to appear nested, and suggested that it would be more effective to wrap each header around th ...

Tips for managing the margin on the right side within a container that has padding applied on the

I am facing an issue with my typical setup, where a div contains content with padding and uses the padding-right property to create separation. However, when items near the right edge, both the padding-right and overall padding (essentially padding-left) ...

Issue with KeyboardDatePicker in Material-UI/Pickers occurs when InputAdornmentProps property with position start is added, leading to an unexpected margin

I am currently working with a component from material-ui/pickers and this is the code snippet: <KeyboardDatePicker value={selectedDate} onChange={(_, newValue) => handleClick(newValue)} labelFunc={renderLabel} disableToolbar variant=&a ...

What is the best way to implement horizontal scrolling in a div with the "inertia" style?

I recently added horizontal scrolling to my website wikiprop.org, following a tutorial from another website. However, I noticed that my scroll does not have the same inertia/momentum effect where it continues scrolling after a swipe and gradually slows dow ...

Tips for alternating the display between parent and child elements using jQuery

I am working with a list that includes parent and children items. Title1 child1 child2 child3 Title2 child1 child2 child3 My goal is to display the parent and children in the following format: title1_child1 title1_child2 title1_child3 title2_chil ...

Instructions for making all the cells in a Bootstrap 3 row the same height

I'm currently working on a grid of cards that can be flipped and have varying content. I'm attempting to make the height of cards with less content equal to the card with the most content. However, regardless of where I use height:100%, the small ...

Selection of two options is maintained in the dropdown menu with data toggle

Having an issue with my dropdown menu that has a data toggle for tabs. Once I select an item, it remains blue and stays selected. Any solutions? https://i.sstatic.net/BZqoL.png Snippet of the code causing the problem: <ul class='nav nav-tabs& ...

Unexpected Facts about Refresh Flicker (Tumblr)

I've been attempting to implement a 'random background on refresh' feature for my Tumblr theme. As some may not be aware, Tumblr themes are comprised of HTML alongside embedded CSS and JavaScript. At the moment, I have been utilizing this p ...

Update the blue glow effect on checkbox inputs within Bootstrap 4 to create a unique visual experience

This query has been asked repeatedly, and I have exhaustively attempted numerous solutions. Here is my code snippet: <div class="btn-group" id="btn-container" data-toggle="buttons"> <label class="btn classic-design"> <input type ...

Troubleshooting Bootstrap: Progress Bar Display Issue

I'm facing an issue with my progress bar on the page. I applied the classes col-xs-12 col-sm-8 to it, but due to these classes, the progress bar is not displaying correctly and there is empty space at the start and end of the progress bar. Here is my ...

Tips for Implementing Show and Hide Functionality in JavaScript

I have a piece of cshtml code similar to the following: <span class="p1"> Breaking India: Western Interventions in Dravidian and Dalit Faultlines is a book authored by Rajiv Malhotra and Aravindan Neelakandan, arguing ...

Create a sleek 2-column design featuring a bonus scroll bar exclusively using CSS styling

In my current project, I have a unique challenge. I am working with a list of flattened div elements and unfortunately, I am unable to edit the HTML markup to add any structures. The first div in the list is quite long, and I would like to place it in a se ...

Customize CSS styles based on Angular material stepper orientation

Is it possible to change the CSS style of an angular material stepper based on its orientation? For instance, can we set a red background when the stepper is displayed vertically and a blue background when horizontal? ...