Toggle navigation
☰
HTML
CSS
Scripting
Database
<!doctype html> <html> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Tailwind CSS Pagination With Numbers</title> <script src="https://cdn.jsdelivr.net/npm/@tailwindcss/browser@4.2.1"></script> </head> <body class="bg-gray-50 flex justify-center min-h-screen pt-16 p-6 antialiased" x-data="{ current: 3 }"> <nav class="bg-white p-4 rounded-[2.5rem] shadow-3xl border border-white flex items-center gap-1"> <!-- Prev --> <button @click="current = Math.max(1, current - 1)" class="h-12 w-12 rounded-2xl flex items-center justify-center text-slate-400 hover:bg-slate-50 hover:text-indigo-600 transition-all cursor-pointer group" :disabled="current === 1" > <svg class="h-5 w-5 group-hover:-translate-x-1 transition-transform" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M15 19l-7-7 7-7" /></svg> </button> <div class="flex items-center gap-1"> <template x-for="page in [1, 2, 3, 4, 5]"> <button @click="current = page" class="h-12 w-12 rounded-2xl text-[11px] font-black tracking-widest uppercase transition-all cursor-pointer flex items-center justify-center" :class="current === page ? 'bg-indigo-600 text-white shadow-xl shadow-indigo-100 rotate-12' : 'text-slate-500 hover:bg-slate-50 hover:text-slate-900'" x-text="page" ></button> </template> </div> <!-- Next --> <button @click="current = Math.min(5, current + 1)" class="h-12 w-12 rounded-2xl flex items-center justify-center text-slate-400 hover:bg-slate-50 hover:text-indigo-600 transition-all cursor-pointer group" :disabled="current === 5" > <svg class="h-5 w-5 group-hover:translate-x-1 transition-transform" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2.5" d="M9 5l7 7-7 7" /></svg> </button> </nav> <script defer src="https://cdn.jsdelivr.net/npm/alpinejs@3.x.x/dist/cdn.min.js"></script> </body> </html>