When using TailwindCSS, <button>
has been reset by CSS Reset. We have to use utilities to compose a simple button.
Version
TailwindCSS 3.0
Simple Button
Simple button with gray background and black text.
<!doctype html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<script src="https://cdn.tailwindcss.com"></script>
<title>TailwindCSS</title>
</head>
<body>
<button class="text-gray-800 bg-gray-200 rounded-lg px-3 py-1">Button</button>
</body>
</html>
Line 10
<button class="text-gray-800 bg-gray-200 rounded-lg px-3 py-1">Button</button>
<button>
with basic style :
text-gray-800
: set foreground text colorbg-gray-200
: set background colorrounded-lg
: set rounded cornerpx-3
: set horizontal paddingpy-1
: set vertical padding
Conclusion
- We can use other utilities to style
<button>