The default underline color in tailwind css is black. How can I change this color for example to a light green. They have listed a way for one to change the default link underline color in the base style as below
@tailwind base;
a {
color: theme('colors.blue');
text-decoration: underline;
}
@tailwind components;
@tailwind utilities;
How would one go about changing the default normal underline color for say a span
tag
There is no way to do that using the default tailwindcss build.
There are 2 ways to override the underline color:
Using simple CSS on your global CSS file
.underline {
text-decoration-color: red;
text-decoration: underline;
}
Extend the underline using the tailwind.config.js
config file:
module.exports = {
theme: {
extend: {}
},
variants: {},
plugins: [
function ({addUtilities}) {
const extendUnderline = {
'.underline': {
'textDecoration': 'underline',
'text-decoration-color': 'red',
},
}
addUtilities(extendUnderline)
}
]
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With