Replies: 3 comments 1 reply
-
These can be useful, particularly to center an absolutely positioned element within its relative parent. Flexbox removes the need for that approach in many use cases though. So this might not need to be available in core, but that's definitely a good idea for a custom plugin that brings these new utilities. You could even create this plugin inside a |
Beta Was this translation helpful? Give feedback.
-
I often use an alternative approach for this. It's 100% Tailwind compatible, but it require an extra wrapper div. <!-- Wrapper element -->
<div class="bg-red-500 h-64 relative">
<!-- Invisible wrapper -->
<div class="absolute w-full h-full top-0 left-0 flex justify-center items-center">
<!-- Element to place in the center -->
<div>Look ma! I'm in the center!</div>
</div>
</div> https://play.tailwindcss.com/k52KmUTncG I agree with your suggestion, as it would require less work. |
Beta Was this translation helpful? Give feedback.
-
@babakfp I was trying to center the tooltip.css .tooltip .tooltip-text {
visibility: hidden;
z-index: 100;
}
.tooltip:hover .tooltip-text {
visibility: visible;
} tooltip.html ...
<div class="tooltip relative w-full ...">Hover me
<div class="tooltip-text absolute left-0 -top-full -mt-1.5 w-max ...">Tooltip left
<svg class="absolute ... h-2.5 left-2.5 top-full" x="0px" y="0px" viewBox="0 0 255 255" xml:space="preserve"><polygon class="fill-current" points="0,0 127.5,127.5 255,0"/></svg>
</div>
<div class="tooltip-text absolute <???> -mt-1.5 w-max ...">Tooltip center
<svg class="absolute ... h-2.5 w-full left-0 top-full" x="0px" y="0px" viewBox="0 0 255 255" xml:space="preserve"><polygon class="fill-current" points="0,0 127.5,127.5 255,0"/></svg>
</div>
<div class="tooltip-text absolute right-0 -top-full -mt-1.5 w-max ...">Tooltip right
<svg class="absolute text-yellow-400 h-2.5 right-2.5 top-full" x="0px" y="0px" viewBox="0 0 255 255" xml:space="preserve"><polygon class="fill-current" points="0,0 127.5,127.5 255,0"/></svg>
</div>
</div>
... where <???> was under search 🤔. Until I read your suggestion. 👍 I hope maintainer to finally include |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
Hi
#13259
Beta Was this translation helpful? Give feedback.
All reactions