1
0
mirror of https://github.com/phuoc-ng/csslayout.git synced 2025-08-29 16:49:58 +02:00

feat: Pagination

This commit is contained in:
Phuoc Nguyen
2022-09-21 16:15:00 +07:00
parent ab1e4a12c4
commit 554dd29aca
7 changed files with 83 additions and 210 deletions

View File

@@ -0,0 +1,6 @@
<div class="pagination">
<div class="pagination__item">1</div>
<div class="pagination__item pagination__item--active">2</div>
<div class="pagination__item">3</div>
<div class="pagination__item">4</div>
</div>

View File

@@ -130,6 +130,7 @@ eleventyExcludeFromCollections: true
{% pattern "Dot navigation" %}{% include "covers/dot-navigation.njk" %}{% endpattern %}
{% pattern "Drawer" %}{% include "covers/drawer.njk" %}{% endpattern %}
{% pattern "Tab" %}{% include "covers/tab.njk" %}{% endpattern %}
{% pattern "Pagination" %}{% include "covers/pagination.njk" %}{% endpattern %}
{% pattern "Wizard" %}{% include "covers/wizard.njk" %}{% endpattern %}
</div>
</div>

50
contents/pagination.md Normal file
View File

@@ -0,0 +1,50 @@
---
layout: layouts/post.njk
title: Pagination
description: Create a pagination with CSS flexbox
keywords: css flexbox, css pagination
---
## HTML
```html
<div class="pagination">
<!-- Pagination item -->
<div class="pagination__item">
...
</div>
<!-- Repeat other items -->
...
</div>
```
## CSS
```css
.pagination {
display: flex;
/* Border */
border: 1px solid #d1d5db;
border-radius: 4px;
}
.pagination__item {
/* Center the content */
align-items: center;
display: flex;
justify-content: center;
}
.pagination__item:not(:last-child) {
/* Right border */
border-right: 1px solid #d1d5db;
}
.pagination__item--active {
background-color: #d1d5db;
}
```
{% demo %}{% include "covers/pagination.njk" %}{% enddemo %}