In this article, i am going to show how to apply custom styles on Tooltip.
In CSS, we have set the content attribute to content: attr(accesskey); this property will display the tooltip by using the accesskey attribute of the anchor tag. Whatever we pass in to the accesskey attribute of the anchor tag it will be displayed as a tooltip. Have something to add to this post? Share it in the comments.
Aspx Code
<table style="width: 300px;">
<tr>
<td>Username:
</td>
<td>
<a href="#" accesskey="Please enter your username" class="tooltipshow">
<input id="txtUsername" type="text" /></a>
</td>
</tr>
<tr>
<td>Password:
</td>
<td>
<a href="#" accesskey="Please enter your password" class="tooltipshow">
<input id="txtPassword" type="text" /></a>
</td>
</tr>
<tr>
<td></td>
<td>
<input id="btnSubmit" type="button" value="Login" />
</td>
</tr>
</table>
CSS Code
.tooltipshow {
display:inline;
position:relative;
text-decoration:none;
top:0;
left:10px;
}
.tooltipshow:hover:after {
background:rgba(0,0,0,.8);
border-radius:5px;
top:-5px;
color:#fff;
content:attr(accesskey);
left:160px;
position:absolute;
z-index:98;
width:150px;
padding:5px 15px;
}
.tooltipshow:hover:before {
border:solid;
bottom:20px;
content:"";
left:155px;
position:absolute;
z-index:99;
top:3px;
border-color:transparent #000;
border-width:6px 6px 6px 0;
}
In CSS, we have set the content attribute to content: attr(accesskey); this property will display the tooltip by using the accesskey attribute of the anchor tag. Whatever we pass in to the accesskey attribute of the anchor tag it will be displayed as a tooltip. Have something to add to this post? Share it in the comments.
Output
That’s it!!…..Happy Programming...
No comments:
Post a Comment