Tags
css
Created
Apr 8, 2024 1:38 PM
反对声音:https://nuejs.org/blog/tailwind-misinformation-engine/
TailwindCSS本身就是一个 PostCSS 插件, 旨在消除样式代码。优点:
- 不要命名
- CSS 不会增长
- 修改不担心破坏其他地方
配置中 theme 字段包含:screens colors spacing,剩下是 corePlugin 的,fontFamily 等等,直接提供是修改默认主题,extend 用来扩展默认主题,如添加响应式断点 screens
@layer 创建 base, components, utilities, variants, Tailwind 插入 @tailwind 位置
theme() 访问 theme 中配置值
- modifiers 可以是伪类、伪元素、响应式断点、dark 等各种媒体查询、supports-[display:grid]、
aria-* - responsive modifiers:默认移动优先,small、medium、large、xl、2xl,md:max-xl 表示范围,min-[203px] max-[320px] 自定义
utility 命名:
aspect-container-columns-box-blockfloat-clear-isolateobject-overflow-overscroll-relativeleft-invisiblez-basis-flex-rowflex-nowrappt-px-ps-pe-m-(同 space-)w-w-1/2w-fullw-svwh-size-font-monotext-smitalicfont-boldtabular-numstracking-wideline-clamp-3leading-tighttext-lefttext-blue-600/50underlineuppercasetruncatetext-wraptext-balanceindent-align-topwhitespace-nowrapbreak-allbg-bg-coverbg-gradient-to-r from-cyan-500 to-blue-500rounded-smrounded-tr-*border-divide-youtline-ring-shadow-opacity-mix-blend-bg-blend-blur-filter-nonebackdrop-blurborder-collapsetransition ease-in-out delay-150scale-translate-xorigin-accent-appearance-autocursor-caret-pointer-events-noneresizescroll-smoothscroll-pt-snap-centertouch-select-nonefill-stroke-sr-only(only screen readers, 屏幕外)forced-color-adjust-none- (group-{modifier})
- !flex(important) // 也可配置全局 important
@tailwindcss/typography 添加基本样式
prettier-plugin-tailwindcss 类名自动排序
@tailwindcss/container-queries 容器查询
@tailwindcss/forms 表单样式
radix // 无样式组件库,shadcn/ui 是 radix+tailwind
daisyui 纯样式组件库
daisyui 自定义:
- @apply 扩展 utility
- Add your own theme.
- Opt out of daisyUI's design decisions, and only use an unstyled (skeleton) version of daisyUI.