I wish to position this border 42px below the text without affecting the <p>
tag:
return (
<div className='hover:border-b-[4px]'>
<p>Collections</p>
</div>
)
How can I accomplish this witout affecting (moving) the contents of the <p>
tag using Tailwind?
2
Answers
Apply
padding-bottom: 42px
to the<div>
element to push the bottom border edge42px
away from the bottom of the<p>
element.I don’t know why exactly 42px but this will work in tailwind-css:
All you have to do is make bot
<div>
and<p>
in a<div>
, also note that I have added h-4, w-4 and a background color to see the changes. in you case I guess you’re using a framework like React or Vue, in this case probably changeclass
intoclassName
.