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.
Written by 3 March 2021
To have a dynamic and attractive website for the visitors, elements must be such that attract more audiences. One of these elements is photo. Because visitors are more inclined to see the photo than to read long texts. For this reason, we must use special styles to make these photos more attractive. One of these styles is the presence of effects on the mouse hover. In the following code, the photo which is normally black and white, becomes gradually colorful when it is pointed by the mouse cursor.
<!-- this script is provided by http://www.htmlfreecode.com coded by: Kerixa Inc. -->
<style>
.color img {
filter: grayscale(100%);
-webkit-filter: grayscale(100%);
-webkit-transition: all 1s ease;
}
.color img:hover {
filter: grayscale(0%);
filter: gray;
-webkit-filter: grayscale(0%);
filter: none;
transition: 1s ease;
}
</style>
<div class="color">
<img src="http://www.htmlfreecode.com/files/sunset.jpg" width="350"/>
</div>
<a target="_blank" href="http://www.htmlfreecode.com/" style="font-size: 8pt; text-decoration: none;font-family:Tahoma">HTML Free Code</a>
<a target='_blank' href='http://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!