Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

110
Views
Bottom align div inside flex container

This is how it looks currently

There are two boxes (outerboxes) side by side in a row. I made the height of the two boxes equal using flexbox. In each box, the text should be aligned from the top (i.e. below the image), and the button should be present at the bottom of the box. How can I align the button to the bottom? I tried multiple ways to make a nested flex box, but nothing worked for me.

css

.rowDisplay {
  display: flex;
}
.outerbox {
  border: 1px solid black;
}
.buttonClass {
  /* tried flex box here as well*/
}

js

<div className = rowDisplay>
  <div className = outerbox>
    <image src = 'path/to/image'>
    <div>
      <div className = textClass>
          {text}  //The text here comes from a variable
      </div>
      <div className = buttonClass>
          <Button onClick={this.handleClickFunction}>
                Click Me
          </Button>
      </div>
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

You can try with nested grids:

.rowDisplay {
  display: flex;
  width: 100px;
}
.outerbox {
  display: grid;
  grid-template-rows: auto 1fr;
  border: 1px solid black;
  margin: 1em;
}
.buttonClass {
  align-self: end;
  border: 1px solid black;
  margin: 1em;
  padding: .5em;
}
.content {
  display: grid;
  grid-template-rows: 1fr auto;
  justify-items: center;
}
.textClass {
  align-self: start;
  margin: .5em;
}
<div class="rowDisplay">
  <div class="outerbox">
    <image src="https://picsum.photos/150" />
    <div class="content">
      <div class="textClass">
         text text text text text
      </div>
      <div class="buttonClass"> 
         Button
      </div>
    </div>
  </div>
  <div class="outerbox">
    <image src="https://picsum.photos/150">
    <div class="content">
      <div class="textClass">
         text 
      </div>
      <div class="buttonClass"> 
         Button
      </div>
    </div>
  </div>
</div>

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!