category: CSS
Posted on: May 5th 2021, 8:55pm
Last modified: May 5th 2021, 8:55pm
First at index.html,
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="stylesheet" href="style.css">
<title>Document</title>
</head>
<body>
<div class="min-h-screen flex justify-center items-center bg-gray-800">
<div class="space-x-6">
<button class="button button--action">button 1</button>
<button class="button button--success">button 2</button>
<button class="button button--warning">button 3</button>
</div>
</div>
</body>
</html>
Then at style.css,
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer components {
.button {
@apply px-3 py-2 text-sm font-medium rounded-md text-white shadow-sm lg:px-8;
}
.button--action {
@apply bg-indigo-600 hover:bg-indigo-500;
}
.button--success {
@apply bg-green-600 hover:bg-green-500;
}
.button--warning {
@apply bg-pink-600 hover:bg-pink-500;
}
}