近期 Tailwindcss 3 的專案想往上升 4,發現其預設的 Preflight 樣式有不少變動。這邊筆記一下要額外補上的內容。
內容
用 @layer base 加上以下內容
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
/* Keep Default from TailwindCSS v3 */ @layer base { *, ::after, ::before, ::backdrop, ::file-selector-button { border-color: var(--color-gray-200, currentColor); } input::placeholder, textarea::placeholder { color: var(--color-gray-400); } button:not(:disabled), [role="button"]:not(:disabled) { cursor: pointer; } dialog { margin: auto; } [type=text], input:where(:not([type])), [type=email], [type=url], [type=password], [type=number], [type=date], [type=datetime-local], [type=month], [type=search], [type=tel], [type=time], [type=week], [multiple], textarea, select { appearance: none; background-color: #fff; border-color: #6b7280; border-width: 1px; border-radius: 0; padding: .5rem .75rem; font-size: 1rem; line-height: 1.5rem; } } |
參考資料
1. Upgrading your Tailwind CSS projects from v3 to v4.
按讚加入粉絲團