Last active
May 30, 2020 23:27
-
-
Save tomhodgins/5296100 to your computer and use it in GitHub Desktop.
HTML inside Bootstrap tooltips
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>Tooltip HTML Styles</title> | |
<!-- Bootstrap: with responsive, no icons --> | |
<link href="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/css/bootstrap-combined.no-icons.min.css" rel="stylesheet"> | |
<!-- FontAwesome --> | |
<link href="http://netdna.bootstrapcdn.com/font-awesome/3.0.2/css/font-awesome.css" rel="stylesheet"> | |
<!-- jQuery --> | |
<script src="http://code.jquery.com/jquery-latest.min.js" type="text/javascript"></script> | |
<!-- Boostrap JavaScript --> | |
<script src="http://netdna.bootstrapcdn.com/twitter-bootstrap/2.3.0/js/bootstrap.min.js"></script> | |
<!-- Source Sans via Google Web Fonts --> | |
<link href='http://fonts.googleapis.com/css?family=Source+Sans+Pro:200,300,400,600,700,900,200italic,300italic,400italic,600italic,700italic,900italic&subset=latin,latin-ext' rel='stylesheet' type='text/css'> | |
</head> | |
<body> | |
<!-- HTML Section --> | |
<div class="container"> | |
<div class="row-fluid"> | |
<div class="span12"> | |
<div class="hero-unit"> | |
<h1 style="text-align:center;">Tooltip HTML Styles</h1> | |
<h2>Default Bootstrap Tooltips, with HTML</h2> | |
<p> | |
<a href="#" data-toggle="tooltip" data-html="true" title="This is a regular Bootstrap tooltip<ul><li>item 1</li><li>item 2</li></ul>">I contain a <ul></a> | |
</p> | |
<p> | |
<a href="#" data-toggle="tooltip" data-html="true" title="<img src='http://placehold.it/250/250'>">I contain an image</a> | |
</p> | |
</div> | |
</div> | |
</div> | |
<!-- JavaScript Section --> | |
<script type="text/javascript"> | |
$(document).ready(function(){ | |
$('a[data-toggle=tooltip]').tooltip(); | |
}); | |
</script> | |
<!-- CSS Section --> | |
<style> | |
* { | |
font-family: 'Source Sans Pro', sans-serif; | |
} | |
.hero-unit { | |
margin-top: 100px; | |
font-weight: 400; | |
} | |
</style> | |
</body> | |
</html> |
can i add class inside ul or li tag?
<3 <3
Is it possible to decode special characters like < in tooltip when bootstrap tooltip is enabled using data-html?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Just for highlighting the answer
data-html="true" is the required attribute to be able to use HTML in tooltip.