Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

How to set height of all elements same to height of max element

I have column content, with elements having different heights. How do I set the height of all of those elements to the same the heightest of all elements?

what i have:

.content {
  border: 1px solid black
}
<div class="container">
  <div class="content">content1</div>
  <div class="content">content2<br>content2</div>
  <div class="content">content3</div>
</div>

how do I set each content height the same as the max height of content?

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

preferably without javascript

>Solution :

The easiest way is to create a 1-column grid and use grid-auto-rows: 1fr. That will size all rows to the largest row:

.container {
  display: grid;
  grid-auto-rows: 1fr;
}

/* for visualization purposes only */
.content {
  border: 2px dashed red;
}
<div class="container">
  <div class="content">content1</div>
  <div class="content">content2<br>content2</div>
  <div class="content">content3</div>
</div>
Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading