惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

量子位
罗磊的独立博客
博客园_首页
T
The Exploit Database - CXSecurity.com
博客园 - 聂微东
雷峰网
雷峰网
V
V2EX
博客园 - 司徒正美
J
Java Code Geeks
Hugging Face - Blog
Hugging Face - Blog
H
Heimdal Security Blog
Apple Machine Learning Research
Apple Machine Learning Research
Last Week in AI
Last Week in AI
K
Kaspersky official blog
爱范儿
爱范儿
T
Threatpost
博客园 - Franky
T
Tailwind CSS Blog
N
News and Events Feed by Topic
P
Privacy & Cybersecurity Law Blog
W
WeLiveSecurity
Google Online Security Blog
Google Online Security Blog
Know Your Adversary
Know Your Adversary
小众软件
小众软件
NISL@THU
NISL@THU
博客园 - 【当耐特】
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
IT之家
IT之家
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
T
Threat Research - Cisco Blogs
Security Latest
Security Latest
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
D
Darknet – Hacking Tools, Hacker News & Cyber Security
P
Palo Alto Networks Blog
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
V
Vulnerabilities – Threatpost
N
News | PayPal Newsroom
C
Cyber Attacks, Cyber Crime and Cyber Security
AI
AI
P
Privacy International News Feed
V
Visual Studio Blog
S
Secure Thoughts
Schneier on Security
Schneier on Security
阮一峰的网络日志
阮一峰的网络日志
S
SegmentFault 最新的问题
人人都是产品经理
人人都是产品经理
博客园 - 叶小钗
C
Cybersecurity and Infrastructure Security Agency CISA
The Cloudflare Blog
Spread Privacy
Spread Privacy

Tailwind CSS Blog

Tailwind CSS v4.3: Scrollbars, new colors, and more Vanilla JavaScript support for Tailwind Plus Compass: A starter kit for online courses Tailwind CSS v4.1: Text shadows, masks, and tons more Tailwind UI is now Tailwind Plus Tailwind CSS v4.0 Tailwind CSS v4.0 Beta 1 Radiant: A beautiful new marketing site template Headless UI v2.1: Simplified transition API and improved multi-dialog support Automatically clean up whitespace and duplicate class names Catalyst: Application layouts, navigation menus, description lists, and more Headless UI v2.0 for React We're hiring a Design Engineer + Staff Engineer Open-sourcing our progress on Tailwind CSS v4.0 Introducing Catalyst: A modern UI kit for React Tailwind CSS v3.4: Dynamic viewport units, :has() support, balanced headlines, subgrid, and more Heroicons Micro: What are these, icons for ants? Meet Studio: Our beautiful new agency site template Tailwind Connect 2023: Recap of our first in-person event New changelog template + the biggest Tailwind UI update ever Tailwind CSS v3.3: Extended color palette, ESM/TS support, logical properties, and more Protocol: A beautiful starting point for your next API documentation site Tailwind CSS v3.2: Dynamic breakpoints, multi-config, and container queries, oh my! We built you a new personal website + Heroicons v2.0, Headless UI v1.7, and more New Tailwind CSS + Framer Motion template and Tailwind Jobs Tailwind UI: Site templates and all-access Tailwind CSS v3.1: You wanna get nuts? Come on, let's get nuts! Headless UI v1.6, Tailwind UI team management, Tailwind Play improvements, and more Headless UI v1.5: The One With Comboboxes Automatic Class Sorting with Prettier Effortless Typography, Even in Dark Mode Standalone CLI: Use Tailwind CSS without Node.js Tailwind CSS v3.0 Introducing Tailwind UI Ecommerce Headless UI v1.4: The One With Tabs Tailwind CSS v2.2 Tailwind UI: Now with React + Vue support Headless UI v1.0 Tailwind CSS v2.1 Heroicons v1.0 Just-In-Time: The Next Generation of Tailwind CSS Welcoming James McDonald to Tailwind Labs "Tailwind CSS: From Zero to Production" on YouTube Welcoming David Luhr to Tailwind Labs Multi-line truncation with @tailwindcss/line-clamp Tailwind CSS v2.0 Tailwind CSS v1.9.0 Introducing Tailwind Play Headless UI: Unstyled, Accessible UI Components "What's new in Tailwind CSS?" on YouTube Tailwind CSS v1.8.0 Utility-Friendly Transitions with @tailwindui/react Introducing Heroicons.com Tailwind CSS v1.7.0 From Nine Hundred to One: How We Hired Robin Malfait Tailwind CSS v1.6.0 Simon Vrachliotis Joins Tailwind Labs Welcoming Brad Cornes to the Team Introducing Tailwind CSS Typography Building the Tailwind Blog with Next.js Introducing linting for Tailwind CSS IntelliSense
Tailwind CSS v1.5.0
2020-07-16 · via Tailwind CSS Blog

I was hoping to save v1.5.0 for something really exciting but we needed a new feature to support the new @tailwindcss/typography plugin so h*ck it, we're dropping some new stuff on you early.

No breaking changes, this is a minor release and we're professionals you silly goose.

New features

Component variants support

Until Tailwind CSS v1.5.0, only "utility" classes were really intended to be used with variants (like "responsive", "hover", "focus", etc.)

While these are still much more useful for utilities than any other type of class, we now support generating variants for component classes as well, like the prose classes in the new @tailwindcss/typography plugin:

<article class="prose md:prose-lg">  <!-- Content --></article>

You can take advantage of this feature in your own component classes by using the new variants option in the second argument of the addComponents plugin API:

plugin(function ({ addComponents })) {  addComponents({    '.card': {      // ...    }  }, {    variants: ['responsive']  })})

...or using the array shorthand you might be familiar with from the addUtilities API:

plugin(function ({ addComponents })) {  addComponents({    '.card': {      // ...    }  }, ['responsive'])})

To take advantage of these feature in your custom CSS (rather than using the plugin API), you can use a new @layer directive to explicitly tell Tailwind that your styles belong to the "components" bucket:

@layer components {  @responsive {    .card {      /* ... */    }  }}

This helps Tailwind purge your unused CSS correctly, ensuring it doesn't remove any responsive component variants when using the default "conservative" purge mode.

Responsive container variants

Piggy-backing off of the new component variants support, the container class now supports variants!

<!-- Only lock the width at `md` sizes and above --><div class="md:container">  <!-- ... --></div>

We've enabled responsive variants by default, but if you are sick in the head you can also manually enable other variants like focus, group-hover, whatever:

module.exports = {  // ...  variants: {    container: ["responsive", "focus", "group-hover"],  },};

New focus-visible variant

We've added support for the :focus-visible pseudo-class using a new focus-visible variant.

This is super useful for adding focus styles that only appear to keyboard users, and are ignored for mouse users:

<button class="focus-visible:shadow-outline focus-visible:outline-none ...">Click me</button>

It's not enabled for anything by default, but you can enable it in the variants section of your config file:

module.exports = {  // ...  variants: {    backgroundColor: ["responsive", "hover", "focus", "focus-visible"],  },};

Browser support is still pretty weak on this but getting better. In the mean time, check out the polyfill and corresponding PostCSS plugin if you'd like to use this in all browsers right away.

New checked variant

We've added a new checked variant you can use to conditionally style things like checkboxes and radio buttons:

<input type="checkbox" class="bg-white checked:bg-blue-500" />

It's not enabled for anything by default, but you can enable it in the variants section of your config file:

module.exports = {  // ...  variants: {    backgroundColor: ["responsive", "hover", "focus", "checked"],  },};

Want to talk about this post? Discuss this on GitHub →