Kombai Logo

Tailwind CSS Border Style

Border style determines the style of the border- solid, dashed, dotted, double, hidden, or none. Tailwind CSS further simplifies adding the border styles through its suite of border style utilities.

In this guide, we will learn how to effectively use border style utilities in Tailwind:

ClassPropertiesExample
border-solidborder-style: solid;<div className="border-solid"></div>
border-dashedborder-style: dashed;<div className="border-dashed"></div>
border-dottedborder-style: dotted;<div className="border-dotted"></div>
border-doubleborder-style: double;<div className="border-double"></div>
border-hiddenborder-style: hidden;<div className="border-hidden"></div>
border-noneborder-style: none;<div className="border-none"></div>

Overview of Border Style

Adding the Border Style

To add the border style to an element, use the border-* utilities, e.g., border-dashed, border-dotted, etc.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Removing the Border Style

To remove the border style from an element, use the border-none utility. This utility is particularly useful when applied on a certain state or breakpoint.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

States and Responsiveness

Hover and Focus States

Tailwind provides state modifiers to apply a border-style only when certain states are active. For example, to apply the border-dashed on hover, use hover:border-dashed.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Breakpoint Modifiers

Breakpoint modifiers enable you to use an utility class at a specific screen width. Tailwind’s default breakpoints include sm, md, lg, xl, and 2xl, but you can customize them in your configuration if necessary. By prepending a breakpoint to a border style utility, you override that style at or beyond a specified min-width. For instance, an element might have border-none on smaller screens but switch to border-solid on medium screens.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Real World Examples

Product Card Grid with Dashed Borders

This example shows a grid of product cards with dashed borders for a modern e-commerce interface.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Team Member Cards with Double Borders

A team member showcase with double-bordered cards for a corporate website.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Feature Comparison Table with Hidden Borders

A pricing comparison table using solid borders on hover.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Blog Post Cards with Dashed Borders

A blog post grid featuring dashed borders for a distinctive look.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Project Showcase with Dotted Borders

A portfolio grid showing projects with dotted borders.

This is a live editor. Play around with it!
export default function App() {
  return <h1>Hello world</h1>
}

Best Practices

Maintain Design Consistency

Maintaining a consistent look across your interface becomes simpler when you set clear guidelines for border usage. By selecting a few specific border styles—solid, dashed, or none, for example—you reduce visual fragmentation and build a brand identity.

Another aspect of consistency is setting uniform border widths and colors for similar elements. When all buttons, cards, and modals share the same baseline border styling, users can better recognize how elements should behave.

Optimize for Reusability

By designing reusable components for card, button, etc. with flexible border utilities, you remove the need to repeatedly define new border styles. If a change in brand direction arises—such as a new theme color or a shift from dotted to dashed borders—you only adjust the shared components.

Tailwind’s utility system can also be extended with custom classes. A single class, such as primary-border, can combine border-style, border-color, and border-width. Then, each element that requires this look references the same utility, guaranteeing consistency.

Accessibility Considerations

Enhance Readability and Navigability

Borders contribute to visual hierarchy and clarify an element’s boundaries, helping all users—particularly those with low vision—differentiate sections. An element with a well-defined border stands out from the background, reducing cognitive load and enabling faster navigation.

High-resolution displays and small devices can make faint or thin borders almost invisible. It’s wise to use an appropriate thickness (border-2 or border-4) or strong color to aid in content legibility. In many contexts, focusing on border styles for active or hovered elements can help direct a user’s attention more effectively.

Support Accessible Interactive Elements

Interactive elements—buttons, cards, forms—benefit especially from distinct borders. A well-defined border signals interactivity, reinforcing established conventions where buttons have noticeable borders.

When implementing complex UI components like sliders or toggles, also consider the effect that hover and focus styles have on user comprehension. For example, a border that transitions from none to solid can indicate interactivity for both mouse and keyboard users.