TailwindCSS-3 基本CSS類別:按鈕示範

當使用了TailwindCSS後,所有HTML預設的標籤樣式會被全部移除,因此<h1><h2>等內容都不會再變大了。

title: TailwindCSS類別
說明:https://tailwindcss.com/docs/padding


01|500

1. 按鈕

01|700

<head>
  <meta charset="UTF-8">
  <title>Tailwindcss-1</title>
  <link rel="stylesheet" href="styles.css">
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.0.0/css/all.min.css">
</head>
<body class="bg-blue-500">
<h1 class="m-4 text-white">Hello</h1>
<div class="mt-10 ml-10 mr-10 flex">
  <button class="px-4 py-2 text-white bg-green-700 rounded border-blue-200 border-2 shadow
      focus:border-red-600 hover:bg-green-200 hover:text-black
      md:w-1/4">
    <i class="fa-solid fa-file-plus"></i> <span>Add</span>
  </button>
</div>
</html>
  1. 圖示使用FontAwesome
  2. m, mt, ml, mr: 設定按鈕區的邊界
  3. p, px, py: 設定按鈕的填充大小
  4. text-white, text-black: 設定文字前景顏色
  5. bg-顏色-深度: 背景顏色
  6. rounded: 圓形邊框,另有大小:
    1. rounded-?? (none, sm, md, lg, xl, 2xl, 3xl, full)
    2. rounded-##-?? (#=t, r, b, l, tl, tr, br, bl)
  7. border 邊框粗細
    1. border, border-x, border-y: 1px
    2. border-?? (0, 2, 4, 8) px
    3. border-#-?? (#=x, y, t, r, b, l)
  8. border-顏色-深度: 邊框顏色
  9. shadow: Box陰影
    1. shadow
    2. shadow-?? (sm, md, lg, xl, 2xl, inner, none )
  10. focus: 有焦點時,hover: 游標經過時
  11. md: 中等大小時 (md=Medium), 斷點:
斷點 意義 大小
sm Small 640px
md Medium 768px
lg Large 1024px
xl Extra Large 1280px
2xl 2x Large 1536px

2. 相關鏈接

##

您可能也會有興趣的類似文章

您可能也會喜歡…

發佈留言

發佈留言必須填寫的電子郵件地址不會公開。 必填欄位標示為 *