Reputation: 2410
Tailwind remove default style for link, I try to add underline to all links.
I tried
@layer base {
a {
@apply underline;
}
But I have no idea where to put the code, I tried inside style tag in my layout blade html file, but its not working.
I tried
<style>
ul-link{
@apply underline;
}
</style>
...
<div class="ul-link">Test</div>
This not working either, no underline.
but like this working
<div class="underline">Test</div>
What am I missing? Why is @apply not working? and How do I create global style?
Upvotes: 1
Views: 2067
Reputation: 8957
You need to add such configurations to base layout in app.css or app.scss file in your project.
@tailwind base;
@tailwind components;
@tailwind utilities;
@layer base {
a {
@apply underline;
}
}
As mentioned in the comments, if you would like this to not apply globally, then use a class name for this.
.a-line {
@apply underline;
}
This way
<a href="#">Text 1</a>
<a href="#" class="a-link">Text 2</a> // will have underline
Upvotes: 3