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:
6
contents/_includes/covers/pagination.njk
Normal file
6
contents/_includes/covers/pagination.njk
Normal 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>
|
@@ -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
50
contents/pagination.md
Normal 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 %}
|
Reference in New Issue
Block a user