1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-09-08 21:30:50 +02:00

feat: Feature list

This commit is contained in:
Phuoc Nguyen
2022-09-19 18:34:42 +07:00
parent 3fa0341174
commit cd700fb737
9 changed files with 113 additions and 169 deletions

View File

@@ -0,0 +1,16 @@
<div class="feature-list">
<div class="feature-list__image">
{% circle "md" %}
</div>
<div class="feature-list__desc">
{% lines "hor", 5 %}
</div>
</div>
<div class="feature-list feature-list--reverse">
<div class="feature-list__image">
{% circle "md" %}
</div>
<div class="feature-list__desc">
{% lines "hor", 5 %}
</div>
</div>

55
contents/feature-list.md Normal file
View File

@@ -0,0 +1,55 @@
---
layout: layouts/post.njk
title: Feature list
description: Create a feature list with CSS flexbox
keywords: css feature list, css flexbox
---
## HTML
```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
```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 "patterns/feature-list.njk" %}
{% enddemo %}

View File

@@ -133,6 +133,12 @@ eleventyExcludeFromCollections: true
<div class="pattern__title">Feature comparison</div>
</a>
</div>
<div class="pattern__item">
<a class="pattern__link" href="/feature-list/">
<div class="pattern__cover">{% include "patterns/feature-list.njk" %}</div>
<div class="pattern__title">Feature list</div>
</a>
</div>
</div>
</div>