PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Outdated Drivers Are Slowing You Down
One free scan finds every outdated or missing driver and matches the right update for your exact hardware.Free scan · exact hardware matchPut both boxes in the same flex or grid container and let the layout stretch them to the height of the tallest one. Do not assign guessed fixed heights to the individual DIVs.
<div class="columns">
<div class="column">Shorter content</div>
<div class="column">Longer content<br>More content</div>
</div>
.columns {
display: flex;
gap: 1rem;
align-items: stretch;
}
.column {
flex: 1;
}
In a horizontal flex row, the tallest item establishes the row height and the other item stretches across that height. The same principle works with CSS Grid.
Use flexbox for two adjacent DIVs
Flexbox is usually the simplest solution when the main requirement is one row of columns. Flex items in a row stretch on the cross axis by default, so align-items: stretch is normally redundant but makes the intent explicit.
.columns {
display: flex;
gap: 1rem;
align-items: stretch;
}
.column {
flex: 1 1 0;
box-sizing: border-box;
padding: 1rem;
background: #f2f2f2;
}
The item containing more text determines the row’s height. Its sibling receives the same outer height, including its padding and border according to the chosen box-sizing rule.
#1 Best Overall
- HTML CSS Design and Build Web Sites
- Comes with secure packaging
- It can be a gift option
Make the columns wrap on small screens
If the boxes should sit side by side only when there is enough room, allow the flex row to wrap and change the direction at a narrow breakpoint.
.columns {
display: flex;
flex-wrap: wrap;
gap: 1rem;
}
.column {
flex: 1 1 20rem;
}
@media (max-width: 42rem) {
.columns {
flex-direction: column;
}
}
When items wrap onto separate flex lines, stretching applies within each line; items on different lines are not required to have one shared height.
Rank #2
Use CSS Grid for row-and-column card layouts
Grid is a strong choice when the design is inherently a set of rows and columns, especially when cards may wrap into additional rows.
.columns {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1rem;
}
.column {
padding: 1rem;
}
Grid items in the same row stretch to that row’s track height, which is established by the tallest content in the row. minmax(0, 1fr) prevents long unbroken content from forcing a track wider than its available space.
Rank #3
Responsive Grid columns
.columns {
display: grid;
grid-template-columns: repeat(auto-fit, minmax(16rem, 1fr));
gap: 1rem;
}
This allows cards to move to new rows as the available width changes. Equal height is guaranteed within each grid row, not across every card in the entire grid.
Equal outer boxes versus equal footers
Stretching equalizes the outer boxes. It does not automatically place buttons, links, or other footer content at the same vertical position when the cards have different internal structures.
Rank #4
- Brand: Wiley
- Set of 2 Volumes
- A handy two-book set that uniquely combines related technologies Highly visual format and accessible language makes these books highly effective learning tools Perfect for beginning web designers and front-end developers
To pin a footer to the bottom of each card, make each card a vertical flex container and allow the main content area to grow.
.column {
display: flex;
flex-direction: column;
padding: 1rem;
}
.column__content {
flex: 1;
}
.column__footer {
margin-top: 1rem;
}
<div class="column">
<div class="column__content">
<h3>Heading</h3>
<p>Variable-length content.</p>
</div>
<div class="column__footer">
<a href="/details">Read more</a>
</div>
</div>
Why fixed heights and margin hacks fail
- Text wraps differently as the viewport, font, or language changes.
- Images, borders, and padding can add to the rendered size.
- Content added later can overflow a fixed-height box.
- Manual margins synchronize one specific screenshot rather than the layout’s actual content.
Let the parent layout calculate the row height instead. Use a fixed height only when the design genuinely requires a fixed viewport or component dimension and overflow behavior has been deliberately designed.
The Tool Desk
Outbyte PC Repair FREERepair Windows errors before they cause bigger problemsFix Now →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →Best Value
If the boxes differ by one pixel
Inspect the element whose background makes the mismatch visible before changing the parent layout. A child border, padding, margin, or box-sizing rule can create an apparent one-pixel difference even when the layout is stretching both siblings correctly.
In the original SitePoint discussion, a responder traced the visible discrepancy to a 1px white bottom border on the final advertising-text item and suggested removing it from that last item:
.abs_top_items:last-child {
border-bottom: none;
}
Debugging checklist
- Use browser developer tools to inspect both computed heights.
- Check child borders, especially on the last element.
- Check padding and margins on the parent and its children.
- Check whether one element uses
box-sizing: border-boxwhile another uses the default content-box model. - Temporarily apply contrasting backgrounds and outlines to identify which box is actually different.
- Remove the smallest offending border or normalize the box-sizing rules instead of adding a compensating height.
CSS table-cell as an alternative
A table-like layout can also equalize adjacent siblings:
.columns {
display: table;
width: 100%;
border-spacing: 1rem 0;
}
.column {
display: table-cell;
width: 50%;
vertical-align: top;
}
This reproduces table-cell sizing behavior and can suit layouts that are naturally table-like. Flexbox generally provides more direct control over alignment, spacing, ordering, and distribution, while Grid is better when explicit rows and columns are central to the design.
Do these 3 things before closing this tab:
1Clear out junk files and repair common Windows errors2Fix the driver behind crashes, sound loss and screen glitches3Repair Windows errors before they cause bigger problemsChoosing the right method
| Need | Recommended layout | Reason |
|---|---|---|
| Two boxes in one horizontal row | Flexbox | One-dimensional alignment and spacing are straightforward. |
| Cards arranged in rows and columns | CSS Grid | Shared row tracks stretch items to the tallest card in each row. |
| Legacy table-like sizing behavior | Table-cell display | Uses table layout’s intrinsic equal-height behavior. |
| Buttons aligned at each card’s bottom | Flex or Grid outer layout plus column flex inside each card | The growing content area pushes the footer downward. |
Browser support and testing
Flexbox and Grid are the current layout tools for this problem, but the sources for the original question do not provide a browser-version compatibility matrix. Test the exact browser versions your site supports, particularly if you must accommodate older Internet Explorer deployments. Do not treat a forum-era workaround as a blanket guarantee for every browser.
Quick Recap
Complete example
<div class="cards">
<article class="card">
<div class="card__content">
<h2>Short card</h2>
<p>A small amount of text.</p>
</div>
<a class="card__footer" href="/one">Open</a>
</article>
<article class="card">
<div class="card__content">
<h2>Long card</h2>
<p>More text makes this card taller, so the other card stretches to the same row height.</p>
</div>
<a class="card__footer" href="/two">Open</a>
</article>
</div>
.cards {
display: grid;
grid-template-columns: repeat(2, minmax(0, 1fr));
gap: 1rem;
}
.card {
display: flex;
flex-direction: column;
padding: 1rem;
border: 1px solid #ccc;
box-sizing: border-box;
}
.card__content {
flex: 1;
}
.card__footer {
margin-top: 1rem;
}
@media (max-width: 42rem) {
.cards {
grid-template-columns: 1fr;
}
}
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




