I’m trying to place a border top and bottom only (not right or left).
From what I can see there are no conflicting css tags
If I use the following it displays nothing:
className="border-y-2 border-gray-3 h-24 ml-4 mb-0 w-full"
If I use this, it displays a border on all sides…
className="border-solid border-y-2 border-gray-3 h-24 ml-4 mb-0 w-full"
Am I missing something on the tailwind docs?
https://tailwindcss.com/docs/border-width#customizing-your-theme
2
Answers
The most common mistake is forgetting to add
@tailwind base
.Inside that, it applies
border-style: solid
to all elements as well as a defaultborder-color
.Moreover,
border-gray-3
is not a default color for tailwind. Maybe you meantborder-gray-300
?Lastly,
border-y
was introduced in version 3, are you sure you’re not using version 1 or 2 ?Use
border-t-2
for top andborder-b-2
for bottom. You can use arbitrary values as wellborder-t-[3px]
.Example using your snippet :