1

I prepared some custom colors for my Tailwind project. When I using "border" class with "text-color" class, border has color of text color.

Additionally, using "border-color" class not respected.

Example: https://play.tailwindcss.com/khYce8N9yU

How to set the same color of background and border and other color for text?

1 Answer 1

2

That is because Tailwind includes border-color as currentColor in preflight styles

You may specify other default border color (for example to be red) like

module.exports = {
    theme: {
        borderColor: {
            DEFAULT: 'red'
        },
    },
}
Sign up to request clarification or add additional context in comments.

3 Comments

Maybe the /_preview of Tailwind incorrect show classes for borders like "border-red", "border-blue" when You prepare just colors, without setting "borderColor" in config?
Not entirely sure I understood what do you mean. But the general use case for borders in Tailwind is to use BOTH classes as border will set border-width and border-color - border color. But if you will use ONLY border it will be colored as default one
Like here second part - both buttons now have green border while in a first (no border color specified) - default current color

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.