mirror of
https://github.com/phuoc-ng/csslayout.git
synced 2025-10-23 10:46:13 +02:00
827 B
827 B
layout, title, description, keywords
layout | title | description | keywords |
---|---|---|---|
layouts/post.njk | Feature list | Create a feature list with CSS flexbox | css feature list, css flexbox |
HTML
<!-- Feature item -->
<div class="feature-list">
<!-- Image -->
<div class="feature-list__image">
...
</div>
<!-- Right side -->
<div class="feature-list__desc">
...
</div>
</div>
<!-- Repeated items -->
...
CSS
.feature-list {
display: flex;
/* OPTIONAL: Spacing between items */
margin: 0.5rem 0;
}
/* Reverse the order of image and content */
.feature-list--reverse {
flex-direction: row-reverse;
}
.feature-list__image {
width: 2rem;
}
.feature-list__desc {
/* Take the remaining width */
flex: 1;
}
{% demo %} {% include "covers/feature-list.njk" %} {% enddemo %}