最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Italic text into a tooltip using Bootstrap - Stack Overflow

programmeradmin4浏览0评论

How may I transform some text to italic using the tooltip of bootstrap ?

This is a snippet code..

In my exemple I want to transform the text "title" to italic !

Thank you

$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();   
});
<script src=".11.3/jquery.min.js"></script>

<script src=".3.5/js/bootstrap.min.js"></script>


<ul>
     <li><a href="#"> msg1</a>
     </li>
     <li data-toggle="tooltip" data-placement="bottom" title="this is a <i> title </i>">
         <a href="#">msg2</a>
     </li>
</ul>

How may I transform some text to italic using the tooltip of bootstrap ?

This is a snippet code..

In my exemple I want to transform the text "title" to italic !

Thank you

$(document).ready(function(){
    $('[data-toggle="tooltip"]').tooltip();   
});
<script src="https://ajax.googleapis./ajax/libs/jquery/1.11.3/jquery.min.js"></script>

<script src="http://maxcdn.bootstrapcdn./bootstrap/3.3.5/js/bootstrap.min.js"></script>


<ul>
     <li><a href="#"> msg1</a>
     </li>
     <li data-toggle="tooltip" data-placement="bottom" title="this is a <i> title </i>">
         <a href="#">msg2</a>
     </li>
</ul>

Share Improve this question edited Jan 14, 2016 at 18:19 Carol Skelly 363k92 gold badges737 silver badges647 bronze badges asked Jan 14, 2016 at 18:14 Mohamed TaboubiMohamed Taboubi 7,05116 gold badges59 silver badges96 bronze badges
Add a ment  | 

3 Answers 3

Reset to default 4

You can add data-html="true" to your li tag as such:

<li data-html="true" data-toggle="tooltip" data-placement="bottom" title="this is a <i> title </i>">
         <a href="#">msg2</a>
</li>

Make sure you use data-html="true" in the tooltip markup.

http://www.codeply./go/tjkGpE9vAJ

To change the text to Italic you can simply do this in your CSS:

.tooltip-inner {
    font-style: italic;
}

This is the class to target the text in the bootstrap tooltip, make sure to include your custom CSS AFTER the bootstrap CSS


EDIT

This opens up a lot more possibilities in styling your tooltip

Hope this helps!

发布评论

评论列表(0)

  1. 暂无评论