Within my design, I have several rows with 3 columns each. Every column contains a main content section labeled SavedSearchBox-content
(with various permutations that affect its height) and a footer labeled SavedSearchBox-footer
.
To structure this layout, I am utilizing flexbox in order to create 3 columns with space between them, meaning only the middle column has horizontal spacing.
Here is the HTML template for a sample row featuring 3 columns and 3 different variations:
- Column with Pill and button
- Column without Pill or button
- Column with Pill but no button
<div class="SavedSearches-wrapper">
<div class="SavedSearchBox">
<div class="SavedSearchBox-content">
<h1 class="SavedSearchBox-title">This is a longer title for testing</h1>
<p class="SavedSearchBox-tagline">This is a tag line</p>
<a href="javascript:;" class="SavedSearchBox-searchLink">This is a link</a>
<div class="SavedSearchBox-propertyCount">
<div class="Pill">4 New</div> <strong>searches</strong>
</div>
</div>
<div class="SavedSearchBox-footer"><a class="Button ">Subscribe to this Alert</a></div>
</div>
<div class="SavedSearchBox">
<div class="SavedSearchBox-content"><h1 class="SavedSearchBox-title">This is a title</h1>
<p class="SavedSearchBox-tagline">This is a tagline</p>
<a href="javascript:;" class="SavedSearchBox-searchLink">This is a link</a>
<div class="SavedSearchBox-propertyCount"></div>
</div>
<div class="SavedSearchBox-footer">
<div class="RadioListToggler SavedSearchBox-Toggler">
<a href="javascript:;" class="RadioListToggler-Link">Change alert frequency</a>
</div>
</div>
</div>
<div class="SavedSearchBox">
<div class="SavedSearchBox-content"><h1 class="SavedSearchBox-title">This is a title</h1>
<p class="SavedSearchBox-tagline">This is a tagline</p>
<a href="javascript:;" class="SavedSearchBox-searchLink">This is a link</a>
<div class="SavedSearchBox-propertyCount">
<div class="Pill">6 New</div> <strong>searches</strong>
</div>
</div>
<div class="SavedSearchBox-footer">
<div class="RadioListToggler SavedSearchBox-Toggler">
<a href="javascript:;" class="RadioListToggler-Link">Change alert frequency</a>
</div>
</div>
</div>
</div>
In terms of the styling, I have applied CSS rules to the wrapper element using flex properties and justify content as follows:
.SavedSearches-wrapper {
padding: 0;
margin: 0;
list-style: none;
display: flex;
flex-flow: row wrap;
width: 100%;
justify-content: space-between;
}
.SavedSearchBox {
max-width: 340px;
width: calc((100%/3) - 64px);
border: 1px solid #d8d8d8;
display: inline-block;
vertical-align: top;
margin: 20px 0px;
background: #ffffff;
}
.SavedSearchBox .SavedSearchBox-content {
padding: 22px 22px 0px 22px;
}
My query pertains to ensuring all instances of SavedSearchBox-content
have consistent heights while maintaining the 3 column layout with space-between
. Ideally, I would prefer to avoid a JavaScript-based solution if possible.
Links: