Styling the arrow on bootstrap tooltips [duplicate

2019-01-08 12:29发布

This question already has an answer here:

I'm trying to style tootltips using

.tooltip-inner{}

But i'm having troubles cause i can't find how to style tooltip small arrow.

As shown on screenshot the arrow of the tooltip is black i want to add new color on that:

enter image description here any suggestion?

10条回答
等我变得足够好
2楼-- · 2019-01-08 12:55

The arrow is a border.
You need to change for each arrow the color depending on the 'data-placement' of the tooltip.

.tooltip.top .tooltip-arrow {
  border-top-color: @color;
}
.tooltip.top-left .tooltip-arrow {
  border-top-color: @color;
}
.tooltip.top-right .tooltip-arrow {
  border-top-color:@color;
}
.tooltip.right .tooltip-arrow {
  border-right-color: @color;
}
.tooltip.left .tooltip-arrow {
  border-left-color: @color;
}
.tooltip.bottom .tooltip-arrow {
  border-bottom-color: @color;
}
.tooltip.bottom-left .tooltip-arrow {
  border-bottom-color: @color;
}
.tooltip.bottom-right .tooltip-arrow {
  border-bottom-color: @color;
}
.tooltip > .tooltip-inner {
  background-color: @color;
}
查看更多
乱世女痞
3楼-- · 2019-01-08 12:55

You can add 'display: none;' to .tooltip-arrow class

.tooltip-arrow {
   display: none;
}
查看更多
一夜七次
4楼-- · 2019-01-08 12:58

In case you are going around and around to figure this out and none of the options above are working, it is possible you are experiencing a name space conflict of .tooltip with bootstrap and jquery.

See this answer on how to fix: jQueryUI Tooltips are competing with Twitter Bootstrap

查看更多
爷的心禁止访问
5楼-- · 2019-01-08 13:00

You can always try putting this code in your main css without modifying the bootstrap file what is most recommended so you keep consistency if in a future you update the bootstrap file.

.tooltip-inner {
background-color: #FF0000;
}

.tooltip.right .tooltip-arrow {
border-right: 5px solid #FF0000;

}

Notice that this example is for a right tooltip. The tooltip-inner property changes the tooltip BG color, the other one changes the arrow color.

查看更多
登录 后发表回答