Border Color
Utilities for controlling the color of an element’s borders.
Show all classes
Control the border color of an element using the utilities.
Changing the opacity
Control the opacity of an element’s border color using the color opacity modifier.
<div class="border-4 border-indigo-500/100 ..."></div>
<div class="border-4 border-indigo-500/75 ..."></div>
<div class="border-4 border-indigo-500/50 ..."></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="border-4 border-indigo-600/[.55] ..."></div>
Individual sides
Use the border-{side}-{color}
utilities to set the border color for one side of an element.
Use the border-{x|y}-{color}
utilities to set the border color on two sides of an element at the same time.
<div class="border-4 border-indigo-200 border-x-indigo-500 ..."></div>
<div class="border-4 border-indigo-200 border-y-indigo-500 ..."></div>
Using logical properties
Use the border-s-*
and border-e-*
utilities to set the border-inline-start-color
and border-inline-end-color
logical properties, which map to either the left or right border based on the text direction.
<div dir="ltr">
<div>
<div dir="rtl">
<div class="border-s-indigo-500 ..."></div>
For more control, you can also use the to conditionally apply specific styles depending on the current text direction.
Hover, focus, and other states
Tailwind lets you conditionally apply utility classes in different states using variant modifiers. For example, use hover:border-gray-500
to only apply the border-gray-500
utility on hover.
Try hovering over the text to see the expected behaviour
For a complete list of all available state modifiers, check out the Hover, Focus, & Other States documentation.
You can also use variant modifiers to target media queries like responsive breakpoints, dark mode, prefers-reduced-motion, and more. For example, use md:border-green-500
to apply the border-green-500
utility at only medium screen sizes and above.
<button class="border-blue-500 md:border-green-500">
<!-- ... -->
</button>
To learn more, check out the documentation on Responsive Design, and other media query modifiers.
Customizing your theme
By default, Tailwind makes the entire available as border colors. You can customize your color palette by editing theme.colors
or in your tailwind.config.js
file.
tailwind.config.js
module.exports = {
theme: {
extend: {
colors: {
'regal-blue': '#243c5a',
},
}
}
}
Alternatively, you can customize just your border colors by editing theme.borderColor
or theme.extend.borderColor
in your tailwind.config.js
file.
Learn more about customizing the default theme in the documentation.
Arbitrary values
If you need to use a one-off 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.