I created a tooltip using Twitter Bootstrap.
The tooltip is displaying with three lines. However, I would like to display the tooltip with only one line.
How
Just override the default max-width
to whatever fits your needs.
.tooltip-inner {
max-width: 350px;
}
When max-width doesn't work (option 1)
If max-width does not work, you could use a set width instead. This is fine, but your tooltips will no longer resize to fit the text. If you don't like that, skip to option 2.
.tooltip-inner {
width: 350px;
}
Correctly dealing with small containers (option 2)
Since Bootstrap appends the tooltip as a sibling of the target, it is constrained by the containing element. If the containing element is smaller than your max-width
, then max-width
won't work.
So, when max-width
doesn't work, you just need to change the container
:
Pro Tip: the container can be any selector, which is nice when you only want to override styles on a few tooltips.