<style> .p-bar{ display: flex; justify-content: center; margin-block: 120px 10px; overflow: scroll; } .p-bar::-webkit-scrollbar { display: none; } .page-nums{ padding: 6px 14px; margin: 0 5px; border-radius: 5px; border: 1px solid rgba(0, 0, 0, 0.176); } .page-nums.active{ background-color: #007bff; color: white; font-weight: bold; border: 1px solid rgba(239, 239, 239, 0.176); transform: scale(1.1); } @media screen and (max-width: 450px) { .p-bar{ width: 100%; display: flex; justify-content: center; margin-block: 120px 10px; } .page-nums{ font-size: 10px; padding: 4px 12px; margin: 0 1px; } .page-nums.active{ transform: scale(1.05); } } </style> <div class="p-bar"> <div class="page-nums page1 {% if 'page1' in segment %} active {% endif %}">1</div> <div class="page-nums page2 {% if 'page2' in segment %} active {% endif %}">2</div> <div class="page-nums page3 {% if 'page3' in segment %} active {% endif %}">3</div> <div class="page-nums page4 {% if 'page4' in segment %} active {% endif %}">4</div> <div class="page-nums page5 {% if 'page5' in segment %} active {% endif %}">5</div> <div class="page-nums page6 {% if 'page6' in segment %} active {% endif %}">6</div> <div class="page-nums page7 {% if 'page7' in segment %} active {% endif %}">7</div> <div class="page-nums page8 {% if 'page8' in segment %} active {% endif %}">8</div> </div>