Tailwind CSS Border Style
Tailwind Border Style
In Tailwind CSS, the border-style
property is used to define the style of the border around an element. There are several styles available, including solid
, dashed
, dotted
, double
, and none
.
Class | Properties |
---|---|
border-solid | border-style: solid; |
border-dashed | border-style: dashed; |
border-dotted | border-style: dotted; |
border-double | border-style: double; |
border-none | border-style: none; |
Applying Tailwind Border Style
In Tailwind CSS, you can apply a border style to an element using the border-{style}
utility, where {style}
is the border style.
For example, to apply a solid border, you would use the border-solid
class as shown below:
<div class="border border-solid">This div has a solid border.</div>
Preview
For example, to give a div a dashed border:
<div class="border border-dashed">This div has a dashed border.</div>
Preview
For example, to give a div a dotted border:
<div class="border border-dotted">This div has a dotted border.</div>
Preview
For example, to give a div a double border:
<div class="border border-double">This div has a double border.</div>
Preview
For example, to give a div a none border:
<div class="border border-none">This div has a none border.</div>
Preview
Customizing Tailwind Border Styles
Tailwind CSS allows you to customize border styles using the tailwind.config.js
file. You can extend the default configuration and define your own custom border styles.
Here's an example of how to add a new border style:
// tailwind.config.js module.exports = { variants: { extend: { // ... borderStyle: ['hover', 'focus'], } } }
<div class="border border-hover">This div has a hover border.</div>
Build modern projects using Bootstrap 5 and Contrast
Trying to create components and pages for a web app or website from
scratch while maintaining a modern User interface can be very tedious.
This is why we created Contrast, to help drastically reduce the amount of time we spend doing that.
so we can focus on building some other aspects of the project.
Contrast Bootstrap PRO consists of a Premium UI Kit Library featuring over 10000+ component variants.
Which even comes bundled together with its own admin template comprising of 5 admin dashboards and 23+ additional admin and multipurpose pages for
building almost any type of website or web app.
See a demo and learn more about Contrast Bootstrap Pro by clicking here.