快速参考

属性
rounded-noneborder-radius: 0px;
rounded-smborder-radius: 0.125rem; /* 2px */
roundedborder-radius: 0.25rem; /* 4px */
rounded-mdborder-radius: 0.375rem; /* 6px */
rounded-lgborder-radius: 0.5rem; /* 8px */
rounded-xlborder-radius: 0.75rem; /* 12px */
rounded-2xlborder-radius: 1rem; /* 16px */
rounded-3xlborder-radius: 1.5rem; /* 24px */
rounded-fullborder-radius: 9999px;
rounded-s-noneborder-start-start-radius: 0px; border-end-start-radius: 0px;
rounded-s-smborder-start-start-radius: 0.125rem; /* 2px */ border-end-start-radius: 0.125rem; /* 2px */
rounded-sborder-start-start-radius: 0.25rem; /* 4px */ border-end-start-radius: 0.25rem; /* 4px */
rounded-s-mdborder-start-start-radius: 0.375rem; /* 6px */ border-end-start-radius: 0.375rem; /* 6px */
rounded-s-lgborder-start-start-radius: 0.5rem; /* 8px */ border-end-start-radius: 0.5rem; /* 8px */
rounded-s-xlborder-start-start-radius: 0.75rem; /* 12px */ border-end-start-radius: 0.75rem; /* 12px */
rounded-s-2xlborder-start-start-radius: 1rem; /* 16px */ border-end-start-radius: 1rem; /* 16px */
rounded-s-3xlborder-start-start-radius: 1.5rem; /* 24px */ border-end-start-radius: 1.5rem; /* 24px */
rounded-s-fullborder-start-start-radius: 9999px; border-end-start-radius: 9999px;
rounded-e-noneborder-start-end-radius: 0px; border-end-end-radius: 0px;
rounded-e-smborder-start-end-radius: 0.125rem; /* 2px */ border-end-end-radius: 0.125rem; /* 2px */
rounded-eborder-start-end-radius: 0.25rem; /* 4px */ border-end-end-radius: 0.25rem; /* 4px */
rounded-e-mdborder-start-end-radius: 0.375rem; /* 6px */ border-end-end-radius: 0.375rem; /* 6px */
rounded-e-lgborder-start-end-radius: 0.5rem; /* 8px */ border-end-end-radius: 0.5rem; /* 8px */
rounded-e-xlborder-start-end-radius: 0.75rem; /* 12px */ border-end-end-radius: 0.75rem; /* 12px */
rounded-e-2xlborder-start-end-radius: 1rem; /* 16px */ border-end-end-radius: 1rem; /* 16px */
rounded-e-3xlborder-start-end-radius: 1.5rem; /* 24px */ border-end-end-radius: 1.5rem; /* 24px */
rounded-e-fullborder-start-end-radius: 9999px; border-end-end-radius: 9999px;
rounded-t-noneborder-top-left-radius: 0px; border-top-right-radius: 0px;
rounded-t-smborder-top-left-radius: 0.125rem; /* 2px */ border-top-right-radius: 0.125rem; /* 2px */
rounded-tborder-top-left-radius: 0.25rem; /* 4px */ border-top-right-radius: 0.25rem; /* 4px */
rounded-t-mdborder-top-left-radius: 0.375rem; /* 6px */ border-top-right-radius: 0.375rem; /* 6px */
rounded-t-lgborder-top-left-radius: 0.5rem; /* 8px */ border-top-right-radius: 0.5rem; /* 8px */
rounded-t-xlborder-top-left-radius: 0.75rem; /* 12px */ border-top-right-radius: 0.75rem; /* 12px */
rounded-t-2xlborder-top-left-radius: 1rem; /* 16px */ border-top-right-radius: 1rem; /* 16px */
rounded-t-3xlborder-top-left-radius: 1.5rem; /* 24px */ border-top-right-radius: 1.5rem; /* 24px */
rounded-t-fullborder-top-left-radius: 9999px; border-top-right-radius: 9999px;
rounded-r-noneborder-top-right-radius: 0px; border-bottom-right-radius: 0px;
rounded-r-smborder-top-right-radius: 0.125rem; /* 2px */ border-bottom-right-radius: 0.125rem; /* 2px */
rounded-rborder-top-right-radius: 0.25rem; /* 4px */ border-bottom-right-radius: 0.25rem; /* 4px */
rounded-r-mdborder-top-right-radius: 0.375rem; /* 6px */ border-bottom-right-radius: 0.375rem; /* 6px */
rounded-r-lgborder-top-right-radius: 0.5rem; /* 8px */ border-bottom-right-radius: 0.5rem; /* 8px */
rounded-r-xlborder-top-right-radius: 0.75rem; /* 12px */ border-bottom-right-radius: 0.75rem; /* 12px */
rounded-r-2xlborder-top-right-radius: 1rem; /* 16px */ border-bottom-right-radius: 1rem; /* 16px */
rounded-r-3xlborder-top-right-radius: 1.5rem; /* 24px */ border-bottom-right-radius: 1.5rem; /* 24px */
rounded-r-fullborder-top-right-radius: 9999px; border-bottom-right-radius: 9999px;
rounded-b-noneborder-bottom-right-radius: 0px; border-bottom-left-radius: 0px;
rounded-b-smborder-bottom-right-radius: 0.125rem; /* 2px */ border-bottom-left-radius: 0.125rem; /* 2px */
rounded-bborder-bottom-right-radius: 0.25rem; /* 4px */ border-bottom-left-radius: 0.25rem; /* 4px */
rounded-b-mdborder-bottom-right-radius: 0.375rem; /* 6px */ border-bottom-left-radius: 0.375rem; /* 6px */
rounded-b-lgborder-bottom-right-radius: 0.5rem; /* 8px */ border-bottom-left-radius: 0.5rem; /* 8px */
rounded-b-xlborder-bottom-right-radius: 0.75rem; /* 12px */ border-bottom-left-radius: 0.75rem; /* 12px */
rounded-b-2xlborder-bottom-right-radius: 1rem; /* 16px */ border-bottom-left-radius: 1rem; /* 16px */
rounded-b-3xlborder-bottom-right-radius: 1.5rem; /* 24px */ border-bottom-left-radius: 1.5rem; /* 24px */
rounded-b-fullborder-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px;
rounded-l-noneborder-top-left-radius: 0px; border-bottom-left-radius: 0px;
rounded-l-smborder-top-left-radius: 0.125rem; /* 2px */ border-bottom-left-radius: 0.125rem; /* 2px */
rounded-lborder-top-left-radius: 0.25rem; /* 4px */ border-bottom-left-radius: 0.25rem; /* 4px */
rounded-l-mdborder-top-left-radius: 0.375rem; /* 6px */ border-bottom-left-radius: 0.375rem; /* 6px */
rounded-l-lgborder-top-left-radius: 0.5rem; /* 8px */ border-bottom-left-radius: 0.5rem; /* 8px */
rounded-l-xlborder-top-left-radius: 0.75rem; /* 12px */ border-bottom-left-radius: 0.75rem; /* 12px */
rounded-l-2xlborder-top-left-radius: 1rem; /* 16px */ border-bottom-left-radius: 1rem; /* 16px */
rounded-l-3xlborder-top-left-radius: 1.5rem; /* 24px */ border-bottom-left-radius: 1.5rem; /* 24px */
rounded-l-fullborder-top-left-radius: 9999px; border-bottom-left-radius: 9999px;
rounded-ss-noneborder-start-start-radius: 0px;
rounded-ss-smborder-start-start-radius: 0.125rem; /* 2px */
rounded-ssborder-start-start-radius: 0.25rem; /* 4px */
rounded-ss-mdborder-start-start-radius: 0.375rem; /* 6px */
rounded-ss-lgborder-start-start-radius: 0.5rem; /* 8px */
rounded-ss-xlborder-start-start-radius: 0.75rem; /* 12px */
rounded-ss-2xlborder-start-start-radius: 1rem; /* 16px */
rounded-ss-3xlborder-start-start-radius: 1.5rem; /* 24px */
rounded-ss-fullborder-start-start-radius: 9999px;
rounded-se-noneborder-start-end-radius: 0px;
rounded-se-smborder-start-end-radius: 0.125rem; /* 2px */
rounded-seborder-start-end-radius: 0.25rem; /* 4px */
rounded-se-mdborder-start-end-radius: 0.375rem; /* 6px */
rounded-se-lgborder-start-end-radius: 0.5rem; /* 8px */
rounded-se-xlborder-start-end-radius: 0.75rem; /* 12px */
rounded-se-2xlborder-start-end-radius: 1rem; /* 16px */
rounded-se-3xlborder-start-end-radius: 1.5rem; /* 24px */
rounded-se-fullborder-start-end-radius: 9999px;
rounded-ee-noneborder-end-end-radius: 0px;
rounded-ee-smborder-end-end-radius: 0.125rem; /* 2px */
rounded-eeborder-end-end-radius: 0.25rem; /* 4px */
rounded-ee-mdborder-end-end-radius: 0.375rem; /* 6px */
rounded-ee-lgborder-end-end-radius: 0.5rem; /* 8px */
rounded-ee-xlborder-end-end-radius: 0.75rem; /* 12px */
rounded-ee-2xlborder-end-end-radius: 1rem; /* 16px */
rounded-ee-3xlborder-end-end-radius: 1.5rem; /* 24px */
rounded-ee-fullborder-end-end-radius: 9999px;
rounded-es-noneborder-end-start-radius: 0px;
rounded-es-smborder-end-start-radius: 0.125rem; /* 2px */
rounded-esborder-end-start-radius: 0.25rem; /* 4px */
rounded-es-mdborder-end-start-radius: 0.375rem; /* 6px */
rounded-es-lgborder-end-start-radius: 0.5rem; /* 8px */
rounded-es-xlborder-end-start-radius: 0.75rem; /* 12px */
rounded-es-2xlborder-end-start-radius: 1rem; /* 16px */
rounded-es-3xlborder-end-start-radius: 1.5rem; /* 24px */
rounded-es-fullborder-end-start-radius: 9999px;
rounded-tl-noneborder-top-left-radius: 0px;
rounded-tl-smborder-top-left-radius: 0.125rem; /* 2px */
rounded-tlborder-top-left-radius: 0.25rem; /* 4px */
rounded-tl-mdborder-top-left-radius: 0.375rem; /* 6px */
rounded-tl-lgborder-top-left-radius: 0.5rem; /* 8px */
rounded-tl-xlborder-top-left-radius: 0.75rem; /* 12px */
rounded-tl-2xlborder-top-left-radius: 1rem; /* 16px */
rounded-tl-3xlborder-top-left-radius: 1.5rem; /* 24px */
rounded-tl-fullborder-top-left-radius: 9999px;
rounded-tr-noneborder-top-right-radius: 0px;
rounded-tr-smborder-top-right-radius: 0.125rem; /* 2px */
rounded-trborder-top-right-radius: 0.25rem; /* 4px */
rounded-tr-mdborder-top-right-radius: 0.375rem; /* 6px */
rounded-tr-lgborder-top-right-radius: 0.5rem; /* 8px */
rounded-tr-xlborder-top-right-radius: 0.75rem; /* 12px */
rounded-tr-2xlborder-top-right-radius: 1rem; /* 16px */
rounded-tr-3xlborder-top-right-radius: 1.5rem; /* 24px */
rounded-tr-fullborder-top-right-radius: 9999px;
rounded-br-noneborder-bottom-right-radius: 0px;
rounded-br-smborder-bottom-right-radius: 0.125rem; /* 2px */
rounded-brborder-bottom-right-radius: 0.25rem; /* 4px */
rounded-br-mdborder-bottom-right-radius: 0.375rem; /* 6px */
rounded-br-lgborder-bottom-right-radius: 0.5rem; /* 8px */
rounded-br-xlborder-bottom-right-radius: 0.75rem; /* 12px */
rounded-br-2xlborder-bottom-right-radius: 1rem; /* 16px */
rounded-br-3xlborder-bottom-right-radius: 1.5rem; /* 24px */
rounded-br-fullborder-bottom-right-radius: 9999px;
rounded-bl-noneborder-bottom-left-radius: 0px;
rounded-bl-smborder-bottom-left-radius: 0.125rem; /* 2px */
rounded-blborder-bottom-left-radius: 0.25rem; /* 4px */
rounded-bl-mdborder-bottom-left-radius: 0.375rem; /* 6px */
rounded-bl-lgborder-bottom-left-radius: 0.5rem; /* 8px */
rounded-bl-xlborder-bottom-left-radius: 0.75rem; /* 12px */
rounded-bl-2xlborder-bottom-left-radius: 1rem; /* 16px */
rounded-bl-3xlborder-bottom-left-radius: 1.5rem; /* 24px */
rounded-bl-fullborder-bottom-left-radius: 9999px;

基本用法

圆角

使用诸如rounded-smroundedrounded-lg之类的实用程序将不同的边框半径大小应用于元素。

rounded

rounded-md

rounded-lg

rounded-full

<div class="rounded ..."></div>
<div class="rounded-md ..."></div>
<div class="rounded-lg ..."></div>
<div class="rounded-full ..."></div>

药丸按钮

使用rounded-full实用程序创建药丸按钮。

rounded-full

<button class="rounded-full ...">Save Changes</button>

无圆角

使用rounded-none从元素中删除现有的边框半径。

rounded-none

<button class="rounded-none ...">Save Changes</button>

这最常用于删除在较小断点处应用的边框半径。

分别圆角

使用 `rounded-{t|r|b|l}{-size?} ` 仅对元素的一侧进行圆角处理。

rounded-t-lg

rounded-r-lg

rounded-b-lg

rounded-l-lg

<div class="rounded-t-lg ..."></div>
<div class="rounded-r-lg ..."></div>
<div class="rounded-b-lg ..."></div>
<div class="rounded-l-lg ..."></div>

单独圆角

使用 `rounded-{tl|tr|br|bl}{-size?} ` 仅对元素的一个角进行圆角处理。

rounded-tl-lg

rounded-tr-lg

rounded-br-lg

rounded-bl-lg

<div class="rounded-tl-lg ..."></div>
<div class="rounded-tr-lg ..."></div>
<div class="rounded-br-lg ..."></div>
<div class="rounded-bl-lg ..."></div>

使用逻辑属性

使用 `rounded-{s|e|ss|se|es|ee}{-size?} ` 实用程序类,使用 逻辑属性 设置边框半径,根据文本方向映射到相应的角。

从左到右

从右到左

<div dir="ltr">
  <div class="rounded-s-lg ..."></div>
<div>

<div dir="rtl">
  <div class="rounded-s-lg ..."></div>
<div>

以下是所有可用的边框颜色逻辑属性实用程序类及其在 LTR 和 RTL 模式下的物理属性等效项。

从左到右从右到左
rounded-s-*rounded-l-*rounded-r-*
rounded-e-*rounded-r-*rounded-l-*
rounded-ss-*rounded-tl-*rounded-tr-*
rounded-se-*rounded-tr-*rounded-tl-*
rounded-es-*rounded-bl-*rounded-br-*
rounded-ee-*rounded-br-*rounded-bl-*

为了获得更多控制,您还可以使用 LTR 和 RTL 修饰符 根据当前文本方向有条件地应用特定样式。


有条件地应用

悬停、聚焦和其他状态

Tailwind 允许您使用变体修饰符在不同状态下有条件地应用实用程序类。例如,使用 `hover:rounded-lg` 仅在悬停时应用 `rounded-lg` 实用程序类。

<div class="rounded hover:rounded-lg">
  <!-- ... -->
</div>

要查看所有可用状态修饰符的完整列表,请查看 悬停、焦点和其他状态 文档。

断点和媒体查询

您还可以使用变体修饰符来定位媒体查询,例如响应式断点、暗模式、 prefers-reduced-motion 等等。例如,使用 md:rounded-lg 仅在中等屏幕尺寸及以上应用 rounded-lg 实用程序。

<div class="rounded md:rounded-lg">
  <!-- ... -->
</div>

要了解更多信息,请查看有关 响应式设计暗模式其他媒体查询修饰符 的文档。


使用自定义值

自定义您的主题

默认情况下,Tailwind 提供五个边框半径大小实用程序。您可以通过编辑 Tailwind 配置的 theme.borderRadius 部分来更改、添加或删除这些实用程序。

tailwind.config.js
module.exports = {
  theme: {
    borderRadius: {
      'none': '0',
      'sm': '0.125rem',
      DEFAULT: '0.25rem',
      DEFAULT: '4px',
      'md': '0.375rem',
      'lg': '0.5rem',
      'full': '9999px',
      'large': '12px',
    }
  }
}

主题自定义 文档中了解有关自定义默认主题的更多信息。

任意值

如果您需要使用一个不适合包含在主题中的 border-radius 值,请使用方括号使用任何任意值动态生成属性。

<div class="rounded-[12px]">
  <!-- ... -->
</div>

了解更多关于在任意值文档中支持任意值的信息。