5 ms·
You can make sure the tooltip flips position to avoid going off the edge of the screen using just CSS?
by andrewingram 9y ago
You can make sure the tooltip flips position to avoid going off the edge of the screen using just CSS?
- Someone1234 9y agoI'm curious to know this too. A responsive "pull-right" that sends an element to the right hand screen edge no matter the screen size, without having it shift onto the line below. I'm sure it can be done if you create enough media selectors for every common resolution but outside of that...
- drinchev 9y agoYou can position the tooltip on the left, right, top, bottom in the markup with a class name. This way if the tooltip is in the header you can use e.g. `tooltip-bottom`. Having 10kb tooltip library for doing this automatically is a bit of an overkill for me [1]. 1 : https://atomiks.github.io/tippyjs/ https://atomiks.github.io/tippyjs/
- nawgszy 9y ago>Having 10kb tooltip library for doing this automatically is a bit of an overkill for me Of course, but I hardly see how that's comparable to writing a React class "ToolTip" which is smart enough to know where the side of the screen is, and comes with the ability to use JS.