Sections
Page Pagination
19 Sep 2022
Page pagination
HTML
SCSS
PostCSS
<section class="pagination">
<div class="cont">
<ul class="pagination__list">
<li class="pagination__item">
<a href="#" class="pagination__arrow">
<i class="icon icon-arrow-prev"></i>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__num pagination__num_active">
<span>1</span>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__num">
<span>2</span>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__num">
<span>3</span>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__num">
<span>4</span>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__num pagination__num_dott">
<span>...</span>
</a>
</li>
<li class="pagination__item">
<a href="#" class="pagination__arrow">
<i class="icon icon-arrow-next"></i>
</a>
</li>
</ul>
</div>
</section>
.pagination {
position: relative;
display: block;
width: 100%;
padding: 20px 0;
&__list {
position: relative;
display: flex;
align-items: center;
width: fit-content;
margin: 0 auto;
}
/* item */
&__item {
position: relative;
display: inline-block;
margin-right: 15px;
}
&__item:first-child {
margin-right: ac(26px, 20px);
}
&__item:last-child {
margin-left: ac(26px, 20px);
margin-right: 0;
}
&__item:nth-last-child(2) {
margin-right: 0;
}
/* num */
&__num {
position: relative;
display: inline-block;
font-size: 16px;
line-height: 1.6em;
color: rgba(255, 255, 255, 0.7);
@include transition-all;
}
&__num:hover,
&__num_active {
color: var(--white);
}
&__num_dott {
position: relative;
display: inline-block;
pointer-events: none;
color: var(--white);
}
/* arrow */
&__arrow {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: ac(50px, 40px);
height: ac(50px, 40px);
border: 2px solid var(--white);
font-size: 12px;
@include transition-all;
}
&__arrow:hover {
border-color: var(--white);
background-color: var(--white);
color: var(--black);
}
&__arrow:active {
transform: translateY(5px);
}
}
.pagination {
position: relative;
display: block;
width: 100%;
padding: 20px 0;
&__list {
position: relative;
display: flex;
align-items: center;
width: fit-content;
margin: 0 auto;
}
/* item */
&__item {
position: relative;
display: inline-block;
margin-right: 15px;
}
&__item:first-child {
margin-right: ac(26px, 20px);
}
&__item:last-child {
margin-left: ac(26px, 20px);
margin-right: 0;
}
&__item:nth-last-child(2) {
margin-right: 0;
}
/* num */
&__num {
position: relative;
display: inline-block;
font-size: 16px;
line-height: 1.6em;
color: rgba(255, 255, 255, 0.7);
@mixin transition-all;
}
&__num:hover,
&__num_active {
color: var(--white);
}
&__num_dott {
position: relative;
display: inline-block;
pointer-events: none;
color: var(--white);
}
/* arrow */
&__arrow {
position: relative;
display: flex;
justify-content: center;
align-items: center;
width: ac(50px, 40px);
height: ac(50px, 40px);
border: 2px solid var(--white);
font-size: 12px;
@mixin transition-all;
}
&__arrow:hover {
border-color: var(--white);
background-color: var(--white);
color: var(--black);
}
&__arrow:active {
transform: translateY(5px);
}
}