Position a div at the bottom of a grid inside another div using tailwind CSS

https://i.sstatic.net/Clw7r.pngi am struggling with the following code

<template>

<div class="grid grid-cols-1 gap-4">
  <div id="test" class="bg-red-700 h-screen">
    <div class="grid grid-cols-1 gap-4 ">
      <p class="bg-black center text-5xl shadow-md w-screen h-200">Lorem ipsum dolor sit amet ...</p>
      <p class="bg-black center text-5xl shadow-md w-screen h-200">Lorem ipsum dolor sit amet ...</p>
      
      <div class="container bg-gray-900 p-10 h-screen text-white">
        <div class="flex justify-center bg-red-500 p-5"><!--inset-0  fill parent-->
          <div class="bg-gray-800 p-10 rounded-xl shadow-lg">
          
          </div>
        </div>
      </div>

    </div>
  </div>
  <div class="bg-blue-800 h-screen">3</div>
  <div class="bg-red-700  h-screen">4</div>
  <div class="bg-blue-800">5</div>
  <div class="bg-red-700">6</div>
  <div class="bg-blue-800">7</div>
</div>
  
</template>

i am trying to place a container at the bottom of the first row in my grid which has alternating blue and red rows. However, I am facing some challenges in achieving this layout.

I wish to position the container at the bottom of the first row with the dark red background, as shown in the image.

Additionally, if I had 3 rows filled with Lorem ipsum dolor sit amet..., how can I move the content of the 3rd row to the bottom?

If there are any uncertainties in my question, please feel free to ask for clarification!

Thank you in advance for your assistance!

Answer №1

It seems like you are looking to display a row with a dark red background below a row with a light red background. Here is the code to achieve this:

Check out the output here

<div class="grid grid-cols-1 gap-4">
    <div id="test" class="bg-red-700 h-screen">
        <div class="grid grid-cols-1 gap-4 ">
            <p class="bg-black center text-5xl shadow-md w-screen h-200">
                Lorem ipsum dolor sit amet ...
            </p>
            <p class="bg-black center text-5xl shadow-md w-screen h-200">
                Lorem ipsum dolor sit amet ...
            </p>
        </div>
    </div>
    <div class="container bg-gray-900 p-10 h-screen text-white">
        <div class="flex justify-center bg-red-500 p-5">
            <div class="bg-gray-800 p-10 rounded-xl shadow-lg"></div>
        </div>
    </div>
    <div class="bg-blue-800 h-screen">3</div>
    <div class="bg-red-700  h-screen">4</div>
    <div class="bg-blue-800">5</div>
    <div class="bg-red-700">6</div>
    <div class="bg-blue-800">7</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

Can anyone explain why my inner div's display is set to block and it is being pushed down when its parent div has

Below is a sample of my HTML+CSS code: <div> <div class="first">text</div> <div>more text</div> </div> div { display: inline; } .first { display: block; } What's interesting is that when the first ...

Place in the Middle of a Bootstrap Container

Struggling with aligning the elements of a Bootstrap well in the center? The badge is off to the side instead of below the arrows, and the vote buttons are not centered within the well. Check out the code snippet below: HTML: <div class="col-md-1 ...

How can I update the chartjs instance?

I am currently working on creating a reactive graph that updates based on certain values. However, I am running into issues where my computed ChartData() function is not updating the component as expected. I have tried using the update() function, but I am ...

Issue with Confirming Password in Laravel Validation

I am currently incorporating Vue.js into my Laravel project and I am facing an issue with validating a confirmation password. Despite entering matching passwords, I continue to receive an error stating that they do not match. <div class="control-grou ...

Unable to retrieve list using Selenium in C# due to issues with FindElements method

Currently, I am working with C# and NUnit. I have encountered an issue where I need to extract the value from a span element and store it in an ArrayList. This is the code I am using to retrieve the price list: var productprice = driver.FindElements(By. ...

Ways to create gaps between rows of a table

I have been attempting to replicate the layout of this table: https://i.sstatic.net/1QuFD.png However, I am running into an issue with the spacing between the rows (border-spacing: 0 2px), and I'm not sure why. Can anyone provide any guidance on thi ...

What is the best way to implement a CSS rule that is influenced by the number of siblings present within an element?

Is there a way to style an element differently based on the number of subelements it contains? <div class="wrapper"> <div class="element" /> </div> or... <div class="wrapper"> <div class="element" /> <div class="el ...

What are the steps to make a div with no content inside?

Presently, I am dealing with 2 overlapping transparent div's each containing unique buttons and functionalities in the following manner: .item1{ height:10rem; width:10rem; position:absolute; border:0.5rem solid red; background-color:trans ...

CSS is functioning properly on a local level, but fails to take effect once the "npm run build" command is executed in the React application's build

I am attempting to override the CSS of Muidrawer-paper. It works locally after running "npm start", but it does not take effect when building the package. .css-12i7wg6-MuiPaper-root-MuiDrawer-paper { position: absolute !important; top: 50px !import ...

What is the best way to position two divs side by side while maintaining their individual padding?

When I remove the padding as shown, the website functions correctly with two div columns next to each other. However, upon adding padding, the #right div shifts downwards. How can I ensure it works as intended with padding included? HTML: Two divs direct ...

Responsive CSS design that adjusts to fit the content

Struggling to make the wrapper expand with its content... This is the structure: * { padding: 0; margin: 0; } body { background-color: #ccc; background-repeat:repeat; font: Tahoma, Geneva, sans-serif; color: #FFF; } .wrapper { width: 95%; margin: 0 au ...

Vue Component Unit Testing: Resolving "Unexpected Identifier" Error in Jest Setup

Having just started using Jest, I wanted to run a simple unit test to make sure everything was set up correctly. However, I encountered numerous errors during compilation while troubleshooting the issues. When running the test suite, Jest successfully loc ...

Replace the default disc icon with a more detailed icon for UL lists

I am working with an unordered list and I want to use <details> to show a sublist for one of the items: <ul> <li><details> <summary>details bullet</summary> <ul> <li>detail 1</li> ...

Is it achievable to delete certain content post window launch in Nuxt.js?

<template> <div> <Ccomponent /> <Dcomponent /> <div @click="openWindow()">hello</div> </div> </template> <script> export default { data() { return ...

Tips for showing the database list based on the chosen value in the drop-down menu

manage_bank Hey there, I need some assistance with displaying the bank name based on the selected dropdown option. For instance, if we choose 50 records, it should display 50 records of the bank name from the database. Additionally, I want the selected v ...

When the user clicks on the body, I want the element to slide up, which will then slide down when the button is clicked

As a novice in Jquery, I am currently implementing a simple slide toggle on a button. Initially, the div is set to display none, and when the button is clicked, the slide toggle function is triggered. This works well. However, I also want the div to slide ...

The term 'string' is typically employed as a data type, yet in this instance it is being utilized as an actual value

Just started working with TypeScript and encountered an issue while trying to set the state. Encountered this error message: 'string' is a type and cannot be used as a value here. const state = reactive({ user: { uid: "", ...

What CSS property prevents a fixed header from overlapping a scrolled element?

After creating a fixed header for my HTML table, I noticed that as I scroll down the page, everything is being overlapped by the fixed header except for one slider (noUiSlider). I am curious to know which CSS property is preventing the header from overlayi ...

Maintain the div height as the image loads

Is there a way to prevent the collapse of the .img-container while an image is loading? Currently, when the image takes a few seconds to load, the container collapses and only expands to full height once the image has loaded. I would like the container to ...

Struggling with the alignment of divs in a vertical manner

Looking for a way to align multiple divs inside another div vertically with even spacing between them? They should all start at the top. Currently, my solution has the child-divs positioned at the top-left corner of the parent div (see the first picture): ...