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
3 Answers
Reset to default 4You 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!