返回介绍

Divide Color

发布于 2024-07-30 22:15:59 字数 138002 浏览 0 评论 0 收藏 0

Utilities for controlling the border color between elements.

Quick reference

ClassPreview 
divide-inherit > * + *
divide-current > * + *
divide-transparent > * + *
divide-black > * + *
divide-white > * + *
divide-slate-50 > * + *
divide-slate-100 > * + *
divide-slate-200 > * + *
divide-slate-300 > * + *
divide-slate-400 > * + *
divide-slate-500 > * + *
divide-slate-600 > * + *
divide-slate-700 > * + *
divide-slate-800 > * + *
divide-slate-900 > * + *
divide-slate-950 > * + *
divide-gray-50 > * + *
divide-gray-100 > * + *
divide-gray-200 > * + *
divide-gray-300 > * + *
divide-gray-400 > * + *
divide-gray-500 > * + *
divide-gray-600 > * + *
divide-gray-700 > * + *
divide-gray-800 > * + *
divide-gray-900 > * + *
divide-gray-950 > * + *
divide-zinc-50 > * + *
divide-zinc-100 > * + *
divide-zinc-200 > * + *
divide-zinc-300 > * + *
divide-zinc-400 > * + *
divide-zinc-500 > * + *
divide-zinc-600 > * + *
divide-zinc-700 > * + *
divide-zinc-800 > * + *
divide-zinc-900 > * + *
divide-zinc-950 > * + *
divide-neutral-50 > * + *
divide-neutral-100 > * + *
divide-neutral-200 > * + *
divide-neutral-300 > * + *
divide-neutral-400 > * + *
divide-neutral-500 > * + *
divide-neutral-600 > * + *
divide-neutral-700 > * + *
divide-neutral-800 > * + *
divide-neutral-900 > * + *
divide-neutral-950 > * + *
divide-stone-50 > * + *
divide-stone-100 > * + *
divide-stone-200 > * + *
divide-stone-300 > * + *
divide-stone-400 > * + *
divide-stone-500 > * + *
divide-stone-600 > * + *
divide-stone-700 > * + *
divide-stone-800 > * + *
divide-stone-900 > * + *
divide-stone-950 > * + *
divide-red-50 > * + *
divide-red-100 > * + *
divide-red-200 > * + *
divide-red-300 > * + *
divide-red-400 > * + *
divide-red-500 > * + *
divide-red-600 > * + *
divide-red-700 > * + *
divide-red-800 > * + *
divide-red-900 > * + *
divide-red-950 > * + *
divide-orange-50 > * + *
divide-orange-100 > * + *
divide-orange-200 > * + *
divide-orange-300 > * + *
divide-orange-400 > * + *
divide-orange-500 > * + *
divide-orange-600 > * + *
divide-orange-700 > * + *
divide-orange-800 > * + *
divide-orange-900 > * + *
divide-orange-950 > * + *
divide-amber-50 > * + *
divide-amber-100 > * + *
divide-amber-200 > * + *
divide-amber-300 > * + *
divide-amber-400 > * + *
divide-amber-500 > * + *
divide-amber-600 > * + *
divide-amber-700 > * + *
divide-amber-800 > * + *
divide-amber-900 > * + *
divide-amber-950 > * + *
divide-yellow-50 > * + *
divide-yellow-100 > * + *
divide-yellow-200 > * + *
divide-yellow-300 > * + *
divide-yellow-400 > * + *
divide-yellow-500 > * + *
divide-yellow-600 > * + *
divide-yellow-700 > * + *
divide-yellow-800 > * + *
divide-yellow-900 > * + *
divide-yellow-950 > * + *
divide-lime-50 > * + *
divide-lime-100 > * + *
divide-lime-200 > * + *
divide-lime-300 > * + *
divide-lime-400 > * + *
divide-lime-500 > * + *
divide-lime-600 > * + *
divide-lime-700 > * + *
divide-lime-800 > * + *
divide-lime-900 > * + *
divide-lime-950 > * + *
divide-green-50 > * + *
divide-green-100 > * + *
divide-green-200 > * + *
divide-green-300 > * + *
divide-green-400 > * + *
divide-green-500 > * + *
divide-green-600 > * + *
divide-green-700 > * + *
divide-green-800 > * + *
divide-green-900 > * + *
divide-green-950 > * + *
divide-emerald-50 > * + *
divide-emerald-100 > * + *
divide-emerald-200 > * + *
divide-emerald-300 > * + *
divide-emerald-400 > * + *
divide-emerald-500 > * + *
divide-emerald-600 > * + *
divide-emerald-700 > * + *
divide-emerald-800 > * + *
divide-emerald-900 > * + *
divide-emerald-950 > * + *
divide-teal-50 > * + *
divide-teal-100 > * + *
divide-teal-200 > * + *
divide-teal-300 > * + *
divide-teal-400 > * + *
divide-teal-500 > * + *
divide-teal-600 > * + *
divide-teal-700 > * + *
divide-teal-800 > * + *
divide-teal-900 > * + *
divide-teal-950 > * + *
divide-cyan-50 > * + *
divide-cyan-100 > * + *
divide-cyan-200 > * + *
divide-cyan-300 > * + *
divide-cyan-400 > * + *
divide-cyan-500 > * + *
divide-cyan-600 > * + *
divide-cyan-700 > * + *
divide-cyan-800 > * + *
divide-cyan-900 > * + *
divide-cyan-950 > * + *
divide-sky-50 > * + *
divide-sky-100 > * + *
divide-sky-200 > * + *
divide-sky-300 > * + *
divide-sky-400 > * + *
divide-sky-500 > * + *
divide-sky-600 > * + *
divide-sky-700 > * + *
divide-sky-800 > * + *
divide-sky-900 > * + *
divide-sky-950 > * + *
divide-blue-50 > * + *
divide-blue-100 > * + *
divide-blue-200 > * + *
divide-blue-300 > * + *
divide-blue-400 > * + *
divide-blue-500 > * + *
divide-blue-600 > * + *
divide-blue-700 > * + *
divide-blue-800 > * + *
divide-blue-900 > * + *
divide-blue-950 > * + *
divide-indigo-50 > * + *
divide-indigo-100 > * + *
divide-indigo-200 > * + *
divide-indigo-300 > * + *
divide-indigo-400 > * + *
divide-indigo-500 > * + *
divide-indigo-600 > * + *
divide-indigo-700 > * + *
divide-indigo-800 > * + *
divide-indigo-900 > * + *
divide-indigo-950 > * + *
divide-violet-50 > * + *
divide-violet-100 > * + *
divide-violet-200 > * + *
divide-violet-300 > * + *
divide-violet-400 > * + *
divide-violet-500 > * + *
divide-violet-600 > * + *
divide-violet-700 > * + *
divide-violet-800 > * + *
divide-violet-900 > * + *
divide-violet-950 > * + *
divide-purple-50 > * + *
divide-purple-100 > * + *
divide-purple-200 > * + *
divide-purple-300 > * + *
divide-purple-400 > * + *
divide-purple-500 > * + *
divide-purple-600 > * + *
divide-purple-700 > * + *
divide-purple-800 > * + *
divide-purple-900 > * + *
divide-purple-950 > * + *
divide-fuchsia-50 > * + *
divide-fuchsia-100 > * + *
divide-fuchsia-200 > * + *
divide-fuchsia-300 > * + *
divide-fuchsia-400 > * + *
divide-fuchsia-500 > * + *
divide-fuchsia-600 > * + *
divide-fuchsia-700 > * + *
divide-fuchsia-800 > * + *
divide-fuchsia-900 > * + *
divide-fuchsia-950 > * + *
divide-pink-50 > * + *
divide-pink-100 > * + *
divide-pink-200 > * + *
divide-pink-300 > * + *
divide-pink-400 > * + *
divide-pink-500 > * + *
divide-pink-600 > * + *
divide-pink-700 > * + *
divide-pink-800 > * + *
divide-pink-900 > * + *
divide-pink-950 > * + *
divide-rose-50 > * + *
divide-rose-100 > * + *
divide-rose-200 > * + *
divide-rose-300 > * + *
divide-rose-400 > * + *
divide-rose-500 > * + *
divide-rose-600 > * + *
divide-rose-700 > * + *
divide-rose-800 > * + *
divide-rose-900 > * + *
divide-rose-950 > * + *

Basic usage

Setting the divide color

Use the divide-* utilities to control the border color between elements.

01 02 03
<div class="divide-y divide-blue-200">
  <div>01</div>
  <div>02</div>
  <div>03</div>
</div>

Changing the opacity

Use the color opacity modifier to control the opacity of the divide color.

01 02 03
<div class="divide-y-4 divide-slate-400/25 ...">
  <!-- ... -->
</div>

You can use any value defined in your opacity scale, or use arbitrary values if you need to deviate from your design tokens.

<div class="divide-y-4 divide-slate-400/[.24] ...">
  <!-- ... -->
</div>

Applying conditionally

Hover, focus, and other states

Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:divide-pink-400 to only apply the divide-pink-400 utility on hover.

<div class="divide-y divide-teal-400 hover:divide-pink-400">
  <!-- ... -->
</div>

For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.

Breakpoints and media queries

You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:divide-pink-400 to apply the divide-pink-400 utility at only medium screen sizes and above.

<div class="divide-y divide-teal-400 md:divide-pink-400">
  <!-- ... -->
</div>

To learn more, check out the documentation on Responsive Design, Dark Mode and other media query modifiers.


Using custom values

Customizing your theme

By default, Tailwind makes the entire default color palette available as divide colors. You can customize your color palette by editing theme.colors or theme.extend.colors in your tailwind.config.js file.

tailwind.config.js
module.exports = {
  theme: {
    extend: {
      colors: {
        'regal-blue': '#243c5a',
      },
    }
  }
}

Alternatively, you can customize just your divide colors by editing theme.divideColor or theme.extend.divideColor in your tailwind.config.js file.

Learn more about customizing the default theme in the theme customization documentation.

Arbitrary values

If you need to use a one-off divide color value that doesn’t make sense to include in your theme, use square brackets to generate a property on the fly using any arbitrary value.

<div class="divide-[#243c5a]">
  <!-- ... -->
</div>

Learn more about arbitrary value support in the arbitrary values documentation.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。
列表为空,暂无数据
    我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
    原文