Utilities for controlling the border radius of an element.
Use utilities like .rounded-sm
, .rounded
, or .rounded-lg
to apply different border radius sizes to an element.
<div class="rounded-sm ..."></div>
<div class="rounded ..."></div>
<div class="rounded-md ..."></div>
<div class="rounded-lg ..."></div>
<div class="rounded-full py-3 px-6...">Pill Shape</div>
<div class="rounded-full h-24 w-24 flex items-center justify-center...">Circle</div>
Use rounded-none
to remove an existing border radius from an element.
This is most commonly used to remove a border radius that was applied at a smaller breakpoint.
<div class="rounded-none ...">.rounded-none</div>
<div class="rounded-t-lg ...">.rounded-t-lg</div>
<div class="rounded-r-lg ...">.rounded-r-lg</div>
<div class="rounded-b-lg ...">.rounded-b-lg</div>
<div class="rounded-l-lg ...">.rounded-l-lg</div>
<div class="rounded-tl-lg ..."></div>
<div class="rounded-tr-lg ..."></div>
<div class="rounded-br-lg ..."></div>
<div class="rounded-bl-lg ..."></div>
To control the border radius of an element at a specific breakpoint, add a {screen}:
prefix to any existing border radius utility. For example, use md:rounded-lg
to apply the rounded-lg
utility at only medium screen sizes and above.
<div class="rounded md:rounded-lg ...">
<!-- ... -->
</div>
For more information about Tailwind’s responsive design features, check out the Responsive Design documentation.
By default, Tailwind provides five border radius size utilities. You can change, add, or remove these by editing the theme.borderRadius
section of your Tailwind config.
// 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 變化模式 (variants) 會產生。
在 tailwind.config.js
的 variants
區塊中變更 borderRadius
屬性來決定有哪些變化模式會生成。
舉個例子來說,這個設定將會生成 響應式 和 hover 的變化模式。
// tailwind.config.js
module.exports = {
variants: {
extend: {
// ...
+ borderRadius: ['responsive', 'hover'],
}
}
}
如果你不打算在專案中使用 border radius 功能,可以在你的設定檔裡的 corePlugins
屬性中將 borderRadius
設定為 false
來停用功能:
// tailwind.config.js
module.exports = {
corePlugins: {
// ...
+ borderRadius: false,
}
}