Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Twitter Bootstrap Tooltip not aligning correctly when it is going to go outside of window

When I have an element associated with a Twitter Bootstrap Tooltip and the Tooltip will overlap outside the browser window, it tries to realign within the window but it misaligns vertically (i.e. the top alignment of the tooltip is now centred rather than above the target element)

Has anyone encountered this before and if so, what was the work around/fix/update?

like image 486
Hamish Rouse Avatar asked Aug 16 '12 02:08

Hamish Rouse


People also ask

How do I change the position of the tooltip in bootstrap?

In Bootstrap 4, you can position the tooltip in various directions (left, right, top, bottom). The positioning of the tooltip is set by using the third-party library (Popper. js) before bootstrap. js in order for the tooltip to work.

How do you align tooltip?

The Tooltip Alignment can be used to align the tooltip to the left or right using the different alignment classes. Primer CSS Tooltip Alignment Class: tooltipped-align-right-1: This class is used on the tooltipped container to align the tooltip to the right of the element with an arrow more intended.

What placement does the tooltip use by default?

Positioning Tooltips By default, the tooltip will appear on top of the element.

How do I change the tooltip position in CSS?

The tooltip text is placed inside an inline element (like <span>) with class="tooltiptext" . CSS: The tooltip class use position:relative , which is needed to position the tooltip text ( position:absolute ). Note: See examples below on how to position the tooltip. The tooltiptext class holds the actual tooltip text.


1 Answers

Yes, others have encountered this before. For example, Issue #4125: Bad position of tooltip or Issue #3556: Tooltips near edge of window don't activate properly.

In the former it is suggested to either disable text wrapping or set a fixed height.

In the latter it is suggested (rather jestingly - but nevertheless potentially useful) to set a different positioning on tooltips you know are going to be near the window edge. E.g., placement: 'left' or placement: 'right'.

At this point there doesn't seem to be any impetus toward getting this handled in the repo.

like image 97
merv Avatar answered Nov 09 '22 03:11

merv