I wish to show my text like "Current page number / Total pages" using CSS
Html code :
<p class="pagenumber> 2 / 5 </p>
Can you assist?
I wish to show my text like "Current page number / Total pages" using CSS
Html code :
<p class="pagenumber> 2 / 5 </p>
Can you assist?
A solution with two extra elements for the numbers and a pseudo element for the dividing line.
You still need to adjust it for your design and layout to make it look good.
.pagenumber {
position: relative;
width: 3em;
height: 3em;
background: #aaa;
border-radius: 50%;
color: #fff;
}
.pagenumber:before {
content: '';
position: absolute;
left: 20%;
right: 20%;
top: 50%;
height: 1px;
background: #fff;
transform: rotate(-30deg);
}
.pagenumber .current {
position: absolute;
text-align: right;
right: 1.5em;
top: 0.5em;
}
.pagenumber .total {
position: absolute;
left: 1.5em;
bottom: 0.5em;
}
<div class="pagenumber">
<div class="current">2</div>
<div class="total">5</div>
</div>
body {
font-size: 12px;
}
.pages {
border-radius: 50%;
background: black;
display: table;
height: 6em;
width: 6em;
color: white;
vertical-align: middle;
font-style: italic;
}
.pages * {
display: table-cell;
font-size: 200%;
}
.pages sup {
vertical-align: middle;
padding-bottom: 15%;
text-align: right;
}
.pages sub {
vertical-align: middle;
padding-top: 15%;
text-align: left;
}
.pages span {
vertical-align: middle;
font-size: 350%;
text-align: center;
}
<p class="pages">
<sup>6</sup><span>/</span><sub>7</sub>
</p>