It's free and you have access to premium codes!
Welcome back! Please login to your account.
Don't worry, we'll send you a message to help you to recover your acount.
Please check your email for instructions to activate your account.
Written by 3 March 2021
Tooltip is a place to put more description about an HTMl element when it is hovered. They are usually simple texts. However, you might need to put some images there. The following code example shows how to put images in tooltips.
<!-- this script is provided by https://www.htmlfreecode.com coded by: Kerixa Inc. -->
<style>
input {
position: relative;
}
input:hover {
cursor: pointer;
}
img {
display: none;
position: absolute;
width: 100px;
height: 100px;
top: 30px;
left: 10px;
border: 1px solid #ddd;
border-radius: 5px;
padding: 3px;
}
</style>
<script src='https://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script>
<form action="">
<input type="text" value="http://www.htmlfreecode.com/files/tooltip.png" />
<img src="" alt="" />
</form>
<a target="_blank" href="http://www.htmlfreecode.com/" style="font-size: 8pt; text-decoration: none;font-family:Tahoma">HTML Free Code</a>
<script>
$(function () {
$('input').hover(function () {
var url = $('input').attr('value');
$('img').attr('src', url);
$('img').css('display', 'block');
}, function () {
$('img').css('display', 'none');
});
});
</script>
<a target='_blank' href='https://www.htmlfreecode.com' style='font-size: 8pt; text-decoration: none'>Html Free Codes</a>
Comments
Here you can leave us commments. Let us know what you think about this code tutorial!