1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-10-23 10:46:13 +02:00
Files
csslayout/contents/statistic.md
2022-09-21 14:31:37 +07:00

53 lines
806 B
Markdown

---
layout: layouts/post.njk
title: Statistic
description: Create a statistic component with CSS flexbox
keywords: css flexbox, css statistic
---
## HTML
```html
<div class="statistic">
<!-- Value -->
<div class="statistic__value">
...
</div>
<!-- Label -->
<div class="statistic__label">
...
</div>
</div>
```
## CSS
```css
.statistic {
/* Center the content */
align-items: center;
display: inline-flex;
flex-direction: column;
}
.statistic__value {
/* Big font size */
font-size: 4rem;
font-weight: 500;
}
.statistic__label {
/* Smaller font size */
font-size: 1rem;
font-weight: 700;
/* Uppercase the label */
text-transform: uppercase;
}
```
{% demo %}
{% include "covers/statistic.njk" %}
{% enddemo %}