2016-03-04 66 views
2

我有一个引导提示是这样的(fiddle):引导提示定位的子元素

enter image description here

<span title='Description about this' data-toggle="tooltip" data-placement="auto top"> 
    <i class="glyphicon glyphicon-star"></i> Some text here 
</span> 

我希望它对齐到里面的图标,但我想实现这不需要将弹出窗口移动到图标元素上,因为工具提示信息的语义属于跨度。

这是它应该如何看,但我不希望使用此标记:

enter image description here

<span> 
    <i class="glyphicon glyphicon-star" title='Description about this' data-toggle="tooltip" data-placement="auto top"></i> 
    Some text here 
</span> 
+0

你可以使用'.tooltip {保证金左:-50px;}',计算实际1/2宽度的跨度要么在JavaScript中或使用一些CSS技巧... – Aprillion

回答

1

您可以重新引导提示类!important

的Html

<div class="content"> 
    <span title='Description about this' data-toggle="tooltip" data-placement="auto top"> 
     <i class="glyphicon glyphicon-star"></i> Some text here 
    </span> 
</div> 

风格

body{ 
    margin: 4em; 
} 
[title]{ 
    cursor: help; 
} 

.content .tooltip{ 
    left: 0 !important; 
} 

https://jsfiddle.net/cLmn9o1n/

+0

不是我真正想要的,因为孩子或父母可以有填充,边距,例如,也不适用于数据放置。 –