- 入门
- 核心概念
- 定制
- Base Styles
- 布局
- Flexbox & Grid
- Flex Basis
- Flex Direction
- Flex Wrap
- Flex
- Flex Grow
- Flex Shrink
- Order
- Grid Template Columns
- Grid Column Start / End
- Grid Template Rows
- Grid Row Start / End
- Grid Auto Flow
- Grid Auto Columns
- Grid Auto Rows
- Gap
- Justify Content
- Justify Items
- Justify Self
- Align Content
- Align Items
- Align Self
- Place Content
- Place Items
- Place Self
- 间隔
- 尺寸
- 排版
- Font Family
- Font Size
- Font Smoothing
- Font Style
- Font Weight
- Font Variant Numeric
- Letter Spacing
- Line Clamp
- Line Height
- List Style Image
- List Style Position
- List Style Type
- Text Align
- Text Color
- Text Decoration
- Text Decoration Color
- Text Decoration Style
- Text Decoration Thickness
- Text Underline Offset
- Text Transform
- Text Overflow
- Text Wrap
- Text Indent
- Vertical Align
- Whitespace
- Word Break
- Hyphens
- Content
- 背景
- 边框
- Effects
- Filters
- 表格 Tables
- Transitions & Animation
- Transforms
- Interactivity
- SVG
- Accessibility
- 其他
- Install Tailwind CSS using PostCSS
- Framework Guides
- Try Tailwind CSS using the Play CDN
- Install Tailwind CSS with Next.js
- Install Tailwind CSS with Laravel
- Install Tailwind CSS with Vite
- Install Tailwind CSS with Nuxt
- Install Tailwind CSS with Gatsby
- Install Tailwind CSS with SolidJS
- Install Tailwind CSS with SvelteKit
- Install Tailwind CSS with Angular
- Install Tailwind CSS with Ruby on Rails
- Install Tailwind CSS with Remix
- Install Tailwind CSS with Phoenix
- Install Tailwind CSS with Parcel
- Install Tailwind CSS with Symfony
- Install Tailwind CSS with Meteor
- Install Tailwind CSS with Create React App
- Install Tailwind CSS with Adonis
- Install Tailwind CSS With Ember.js
- Install Tailwind CSS with Astro
- Install Tailwind CSS with Qwik
- Install Tailwind CSS with Rspack
Border Radius
Utilities for controlling the border radius of an element.
Quick reference
Class | Properties |
---|---|
rounded-none | border-radius: 0px; |
rounded-sm | border-radius: 0.125rem; /* 2px */ |
rounded | border-radius: 0.25rem; /* 4px */ |
rounded-md | border-radius: 0.375rem; /* 6px */ |
rounded-lg | border-radius: 0.5rem; /* 8px */ |
rounded-xl | border-radius: 0.75rem; /* 12px */ |
rounded-2xl | border-radius: 1rem; /* 16px */ |
rounded-3xl | border-radius: 1.5rem; /* 24px */ |
rounded-full | border-radius: 9999px; |
rounded-s-none | border-start-start-radius: 0px; border-end-start-radius: 0px; |
rounded-s-sm | border-start-start-radius: 0.125rem; /* 2px */ border-end-start-radius: 0.125rem; /* 2px */ |
rounded-s | border-start-start-radius: 0.25rem; /* 4px */ border-end-start-radius: 0.25rem; /* 4px */ |
rounded-s-md | border-start-start-radius: 0.375rem; /* 6px */ border-end-start-radius: 0.375rem; /* 6px */ |
rounded-s-lg | border-start-start-radius: 0.5rem; /* 8px */ border-end-start-radius: 0.5rem; /* 8px */ |
rounded-s-xl | border-start-start-radius: 0.75rem; /* 12px */ border-end-start-radius: 0.75rem; /* 12px */ |
rounded-s-2xl | border-start-start-radius: 1rem; /* 16px */ border-end-start-radius: 1rem; /* 16px */ |
rounded-s-3xl | border-start-start-radius: 1.5rem; /* 24px */ border-end-start-radius: 1.5rem; /* 24px */ |
rounded-s-full | border-start-start-radius: 9999px; border-end-start-radius: 9999px; |
rounded-e-none | border-start-end-radius: 0px; border-end-end-radius: 0px; |
rounded-e-sm | border-start-end-radius: 0.125rem; /* 2px */ border-end-end-radius: 0.125rem; /* 2px */ |
rounded-e | border-start-end-radius: 0.25rem; /* 4px */ border-end-end-radius: 0.25rem; /* 4px */ |
rounded-e-md | border-start-end-radius: 0.375rem; /* 6px */ border-end-end-radius: 0.375rem; /* 6px */ |
rounded-e-lg | border-start-end-radius: 0.5rem; /* 8px */ border-end-end-radius: 0.5rem; /* 8px */ |
rounded-e-xl | border-start-end-radius: 0.75rem; /* 12px */ border-end-end-radius: 0.75rem; /* 12px */ |
rounded-e-2xl | border-start-end-radius: 1rem; /* 16px */ border-end-end-radius: 1rem; /* 16px */ |
rounded-e-3xl | border-start-end-radius: 1.5rem; /* 24px */ border-end-end-radius: 1.5rem; /* 24px */ |
rounded-e-full | border-start-end-radius: 9999px; border-end-end-radius: 9999px; |
rounded-t-none | border-top-left-radius: 0px; border-top-right-radius: 0px; |
rounded-t-sm | border-top-left-radius: 0.125rem; /* 2px */ border-top-right-radius: 0.125rem; /* 2px */ |
rounded-t | border-top-left-radius: 0.25rem; /* 4px */ border-top-right-radius: 0.25rem; /* 4px */ |
rounded-t-md | border-top-left-radius: 0.375rem; /* 6px */ border-top-right-radius: 0.375rem; /* 6px */ |
rounded-t-lg | border-top-left-radius: 0.5rem; /* 8px */ border-top-right-radius: 0.5rem; /* 8px */ |
rounded-t-xl | border-top-left-radius: 0.75rem; /* 12px */ border-top-right-radius: 0.75rem; /* 12px */ |
rounded-t-2xl | border-top-left-radius: 1rem; /* 16px */ border-top-right-radius: 1rem; /* 16px */ |
rounded-t-3xl | border-top-left-radius: 1.5rem; /* 24px */ border-top-right-radius: 1.5rem; /* 24px */ |
rounded-t-full | border-top-left-radius: 9999px; border-top-right-radius: 9999px; |
rounded-r-none | border-top-right-radius: 0px; border-bottom-right-radius: 0px; |
rounded-r-sm | border-top-right-radius: 0.125rem; /* 2px */ border-bottom-right-radius: 0.125rem; /* 2px */ |
rounded-r | border-top-right-radius: 0.25rem; /* 4px */ border-bottom-right-radius: 0.25rem; /* 4px */ |
rounded-r-md | border-top-right-radius: 0.375rem; /* 6px */ border-bottom-right-radius: 0.375rem; /* 6px */ |
rounded-r-lg | border-top-right-radius: 0.5rem; /* 8px */ border-bottom-right-radius: 0.5rem; /* 8px */ |
rounded-r-xl | border-top-right-radius: 0.75rem; /* 12px */ border-bottom-right-radius: 0.75rem; /* 12px */ |
rounded-r-2xl | border-top-right-radius: 1rem; /* 16px */ border-bottom-right-radius: 1rem; /* 16px */ |
rounded-r-3xl | border-top-right-radius: 1.5rem; /* 24px */ border-bottom-right-radius: 1.5rem; /* 24px */ |
rounded-r-full | border-top-right-radius: 9999px; border-bottom-right-radius: 9999px; |
rounded-b-none | border-bottom-right-radius: 0px; border-bottom-left-radius: 0px; |
rounded-b-sm | border-bottom-right-radius: 0.125rem; /* 2px */ border-bottom-left-radius: 0.125rem; /* 2px */ |
rounded-b | border-bottom-right-radius: 0.25rem; /* 4px */ border-bottom-left-radius: 0.25rem; /* 4px */ |
rounded-b-md | border-bottom-right-radius: 0.375rem; /* 6px */ border-bottom-left-radius: 0.375rem; /* 6px */ |
rounded-b-lg | border-bottom-right-radius: 0.5rem; /* 8px */ border-bottom-left-radius: 0.5rem; /* 8px */ |
rounded-b-xl | border-bottom-right-radius: 0.75rem; /* 12px */ border-bottom-left-radius: 0.75rem; /* 12px */ |
rounded-b-2xl | border-bottom-right-radius: 1rem; /* 16px */ border-bottom-left-radius: 1rem; /* 16px */ |
rounded-b-3xl | border-bottom-right-radius: 1.5rem; /* 24px */ border-bottom-left-radius: 1.5rem; /* 24px */ |
rounded-b-full | border-bottom-right-radius: 9999px; border-bottom-left-radius: 9999px; |
rounded-l-none | border-top-left-radius: 0px; border-bottom-left-radius: 0px; |
rounded-l-sm | border-top-left-radius: 0.125rem; /* 2px */ border-bottom-left-radius: 0.125rem; /* 2px */ |
rounded-l | border-top-left-radius: 0.25rem; /* 4px */ border-bottom-left-radius: 0.25rem; /* 4px */ |
rounded-l-md | border-top-left-radius: 0.375rem; /* 6px */ border-bottom-left-radius: 0.375rem; /* 6px */ |
rounded-l-lg | border-top-left-radius: 0.5rem; /* 8px */ border-bottom-left-radius: 0.5rem; /* 8px */ |
rounded-l-xl | border-top-left-radius: 0.75rem; /* 12px */ border-bottom-left-radius: 0.75rem; /* 12px */ |
rounded-l-2xl | border-top-left-radius: 1rem; /* 16px */ border-bottom-left-radius: 1rem; /* 16px */ |
rounded-l-3xl | border-top-left-radius: 1.5rem; /* 24px */ border-bottom-left-radius: 1.5rem; /* 24px */ |
rounded-l-full | border-top-left-radius: 9999px; border-bottom-left-radius: 9999px; |
rounded-ss-none | border-start-start-radius: 0px; |
rounded-ss-sm | border-start-start-radius: 0.125rem; /* 2px */ |
rounded-ss | border-start-start-radius: 0.25rem; /* 4px */ |
rounded-ss-md | border-start-start-radius: 0.375rem; /* 6px */ |
rounded-ss-lg | border-start-start-radius: 0.5rem; /* 8px */ |
rounded-ss-xl | border-start-start-radius: 0.75rem; /* 12px */ |
rounded-ss-2xl | border-start-start-radius: 1rem; /* 16px */ |
rounded-ss-3xl | border-start-start-radius: 1.5rem; /* 24px */ |
rounded-ss-full | border-start-start-radius: 9999px; |
rounded-se-none | border-start-end-radius: 0px; |
rounded-se-sm | border-start-end-radius: 0.125rem; /* 2px */ |
rounded-se | border-start-end-radius: 0.25rem; /* 4px */ |
rounded-se-md | border-start-end-radius: 0.375rem; /* 6px */ |
rounded-se-lg | border-start-end-radius: 0.5rem; /* 8px */ |
rounded-se-xl | border-start-end-radius: 0.75rem; /* 12px */ |
rounded-se-2xl | border-start-end-radius: 1rem; /* 16px */ |
rounded-se-3xl | border-start-end-radius: 1.5rem; /* 24px */ |
rounded-se-full | border-start-end-radius: 9999px; |
rounded-ee-none | border-end-end-radius: 0px; |
rounded-ee-sm | border-end-end-radius: 0.125rem; /* 2px */ |
rounded-ee | border-end-end-radius: 0.25rem; /* 4px */ |
rounded-ee-md | border-end-end-radius: 0.375rem; /* 6px */ |
rounded-ee-lg | border-end-end-radius: 0.5rem; /* 8px */ |
rounded-ee-xl | border-end-end-radius: 0.75rem; /* 12px */ |
rounded-ee-2xl | border-end-end-radius: 1rem; /* 16px */ |
rounded-ee-3xl | border-end-end-radius: 1.5rem; /* 24px */ |
rounded-ee-full | border-end-end-radius: 9999px; |
rounded-es-none | border-end-start-radius: 0px; |
rounded-es-sm | border-end-start-radius: 0.125rem; /* 2px */ |
rounded-es | border-end-start-radius: 0.25rem; /* 4px */ |
rounded-es-md | border-end-start-radius: 0.375rem; /* 6px */ |
rounded-es-lg | border-end-start-radius: 0.5rem; /* 8px */ |
rounded-es-xl | border-end-start-radius: 0.75rem; /* 12px */ |
rounded-es-2xl | border-end-start-radius: 1rem; /* 16px */ |
rounded-es-3xl | border-end-start-radius: 1.5rem; /* 24px */ |
rounded-es-full | border-end-start-radius: 9999px; |
rounded-tl-none | border-top-left-radius: 0px; |
rounded-tl-sm | border-top-left-radius: 0.125rem; /* 2px */ |
rounded-tl | border-top-left-radius: 0.25rem; /* 4px */ |
rounded-tl-md | border-top-left-radius: 0.375rem; /* 6px */ |
rounded-tl-lg | border-top-left-radius: 0.5rem; /* 8px */ |
rounded-tl-xl | border-top-left-radius: 0.75rem; /* 12px */ |
rounded-tl-2xl | border-top-left-radius: 1rem; /* 16px */ |
rounded-tl-3xl | border-top-left-radius: 1.5rem; /* 24px */ |
rounded-tl-full | border-top-left-radius: 9999px; |
rounded-tr-none | border-top-right-radius: 0px; |
rounded-tr-sm | border-top-right-radius: 0.125rem; /* 2px */ |
rounded-tr | border-top-right-radius: 0.25rem; /* 4px */ |
rounded-tr-md | border-top-right-radius: 0.375rem; /* 6px */ |
rounded-tr-lg | border-top-right-radius: 0.5rem; /* 8px */ |
rounded-tr-xl | border-top-right-radius: 0.75rem; /* 12px */ |
rounded-tr-2xl | border-top-right-radius: 1rem; /* 16px */ |
rounded-tr-3xl | border-top-right-radius: 1.5rem; /* 24px */ |
rounded-tr-full | border-top-right-radius: 9999px; |
rounded-br-none | border-bottom-right-radius: 0px; |
rounded-br-sm | border-bottom-right-radius: 0.125rem; /* 2px */ |
rounded-br | border-bottom-right-radius: 0.25rem; /* 4px */ |
rounded-br-md | border-bottom-right-radius: 0.375rem; /* 6px */ |
rounded-br-lg | border-bottom-right-radius: 0.5rem; /* 8px */ |
rounded-br-xl | border-bottom-right-radius: 0.75rem; /* 12px */ |
rounded-br-2xl | border-bottom-right-radius: 1rem; /* 16px */ |
rounded-br-3xl | border-bottom-right-radius: 1.5rem; /* 24px */ |
rounded-br-full | border-bottom-right-radius: 9999px; |
rounded-bl-none | border-bottom-left-radius: 0px; |
rounded-bl-sm | border-bottom-left-radius: 0.125rem; /* 2px */ |
rounded-bl | border-bottom-left-radius: 0.25rem; /* 4px */ |
rounded-bl-md | border-bottom-left-radius: 0.375rem; /* 6px */ |
rounded-bl-lg | border-bottom-left-radius: 0.5rem; /* 8px */ |
rounded-bl-xl | border-bottom-left-radius: 0.75rem; /* 12px */ |
rounded-bl-2xl | border-bottom-left-radius: 1rem; /* 16px */ |
rounded-bl-3xl | border-bottom-left-radius: 1.5rem; /* 24px */ |
rounded-bl-full | border-bottom-left-radius: 9999px; |
Basic usage
Rounded corners
Use utilities like rounded-sm
, rounded
, or rounded-lg
to apply different border radius sizes to an element.
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>
Pill buttons
Use the rounded-full
utility to create pill buttons.
rounded-full
<button class="rounded-full ...">Save Changes</button>
No rounding
Use rounded-none
to remove an existing border radius from an element.
rounded-none
<button class="rounded-none ...">Save Changes</button>
This is most commonly used to remove a border radius that was applied at a smaller breakpoint.
Rounding sides separately
Use the rounded-t-*
, rounded-r-*
, rounded-b-*
, and rounded-l-*
utilities to only round one side of an element.
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>
Rounding corners separately
Use the rounded-tl-*
, rounded-tr-*
, rounded-br-*
, and rounded-bl-*
utilities to only round one corner of an element.
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>
Using logical properties
Use the rounded-s-*
, rounded-e-*
, rounded-ss-*
, rounded-se-*
, rounded-es-*
, and rounded-ee-*
utilities to set the border radius using logical properties, which map to the appropriate corners based on the text direction.
Left-to-right
Right-to-left
<div dir="ltr">
<div class="rounded-s-lg ..."></div>
<div>
<div dir="rtl">
<div class="rounded-s-lg ..."></div>
<div>
Here are all the available border color logical property utilities and their physical property equivalents in both LTR and RTL modes.
Class | Left-to-right | Right-to-left |
---|---|---|
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-* |
For more control, you can also use the LTR and RTL modifiers to conditionally apply specific styles depending on the current text direction.
Applying conditionally
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:rounded-lg
to only apply the rounded-lg
utility on hover.
<div class="rounded hover:rounded-lg">
<!-- ... -->
</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:rounded-lg
to apply the rounded-lg
utility at only medium screen sizes and above.
<div class="rounded md:rounded-lg">
<!-- ... -->
</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 provides five border radius size utilities. You can change, add, or remove these by editing the theme.borderRadius
section of your Tailwind config.
module.exports = {
theme: {
borderRadius: {
'none': '0',
'sm': '0.125rem',
DEFAULT: '0.25rem',
DEFAULT: '4px',
'md': '0.375rem',
'lg': '0.5rem',
'full': '9999px',
'large': '12px',
}
}
}
Learn more about customizing the default theme in the theme customization documentation.
Arbitrary values
If you need to use a one-off border-radius
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="rounded-[12px]">
<!-- ... -->
</div>
Learn more about arbitrary value support in the arbitrary values documentation.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论