Reputation: 1020
I have the below html, how to apply the styling using span for the title attribute of the div. I applied a background color for the id 'tooltip-value' and it was not applied in this case, how to make it work?
Here is the jsfiddle link, http://jsfiddle.net/KendoDev/qtyL1rdm/
<div class="tooltip">
<div id='column1' title='<span id="tooltip-value">1</span>' style="width: 40px;">1</div>
<div id='column2' title="2" style="width: 20px;">2 </div>
</div>
Upvotes: 0
Views: 5900
Reputation: 2874
You can't style default tooltip but you can use data-attributes
for styling this messege with using content:attr(data-attribute);
.tooltip{padding:20px 0;}
.tooltip div {
font: 10px sans-serif;
background-color: blue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
}
#column1 {
font: 10px sans-serif;
background-color: blue;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
display: inline-block;
position:relative;
}
#column1:after{
content:attr(data-title);
position:absolute;
bottom:100%;
left:100%;
color:#fff;
background:#000;
padding:5px;
display:none;
}
#column1:hover:after{display:block;}
#column2 {
font: 10px sans-serif;
background-color: Red;
text-align: right;
padding: 3px;
margin: 1px;
color: white;
display: inline-block;
position:relative;
}
#column2:after{
content:attr(data-title);
position:absolute;
bottom:100%;
left:100%;
color:#000;
background:#eee;
padding:5px;
display:none;
}
#column2:hover:after{display:block;}
Upvotes: 1