on mouseover hover large images using css

on mouseover hover states means, where an image or background image changes when you move your mouse cursor into that area of the page. Traditionally, this change in image is handled via JavaScript. It’s fairly easy to write a small script that swaps out images on mouseover, but there are a number of disadvantages to this approach that have pushed many web developers toward using a CSS-only method of achieving this exact same effect.

In this tutorial i am explaining exactly how to implement a pure CSS image hover view large image effect.

CSS CODE FOR ON MOUSEHOVER LARGE IMAGE

<style>
.main_div{
    width: 576px;
    margin:auto;
    float:none;
    margin-top:215px;
}

.main_div a{
    float:left;
    padding:5px 5px;
    background-color:#FFFFFF;
    color:#464644;
    font-size:15px;
    text-align:center;
    text-decoration:none;
    position:relative;
}


.main_div a img{
    width:130px;
    border:2px solid #000;
    min-height:100px;
}


.main_div a span {
    position:absolute;
    visibility:hidden;
    height:205px;
    width:300px;
    z-index:99;
    background-color:#000;
    color:#fff;
    text-align:center;
    font-size:16px;
    line-height:20px;
    padding:2px 4px;
    border:3px solid #000;
    border-radius:6px;
    margin-top:-200px;
    margin-left:-200px;
}

.main_div a span img{
    width:100%;
    height:175px;
    margin-bottom: 3px;
}

.main_div a:hover span {
    visibility:visible;
}
</style>

HTML CODE FOR ON MOUSEHOVER LARGE IMAGE

<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>on mouseover hover large images using css - phpkida</title>
</head>

<body>

<div class="main_div">
    <a href="http://www.newstriger.com/gadgets/samsung/full-specifications-samsung-galaxy-j7-prime/" target="_blank">
        <img src="Full Specifications Samsung Galaxy J7 Prime.jpg" />
        <span><img src="Full Specifications Samsung Galaxy J7 Prime.jpg" /><br />Full Specifications Samsung Galaxy J7 Prime</span>
    </a>
    <a href="http://www.newstriger.com/jaigarh-fort/" target="_blank">
        <img src="JAIGARH FORT JAIPUR RAJASTHAN.jpg" />
        <span><img src="JAIGARH FORT JAIPUR RAJASTHAN.jpg" /><br />Jaigarh Fort Jaipur Rajasthan</span>
    </a>
    <a href="http://www.newstriger.com/top-10-most-expensive-movies-ever-made-bollywood-hollywood-news-hindi/" target="_blank">
        <img src="top-10-most-expensive-movies-ever-made-bollywood-hollywood-news-hindi.jpg" />
        <span><img src="top-10-most-expensive-movies-ever-made-bollywood-hollywood-news-hindi.jpg" /><br />Top 10 most expensive movies ever</span>
    </a>
    <a href="http://www.newstriger.com/monsoon-palace/" target="_blank">
        <img src="mansoon-palace-udaipur.jpg" />
        <span><img src="mansoon-palace-udaipur.jpg" /><br />Mansoon Palace Udaipur</span>
    </a>
    <div style="clear:both;"></div>
</div>


</body>
</html>

You Can Download Source Code of This Tutorial

If You have any question and problem in this code feel free, leave comment below! SHARE WITH YOUR FRIENDS..

Mukesh Jakhar - PHP Web Developer
Mukesh Jakhar

This is Mukesh Jakhar. I’m a professional web developer with 3+ years experience. I am always ready for freelance work and i am writing blogs in my free time. I love to learn new technologies and share with others.

I founded PHPKIDA in September 2015. The focus of this website to provide web development tutorials of PHP, WordPress, CodeIgniter, Jquery, MySQL, HMTL, CSS etc and sharing solution to problems which i already solved.

Sign up for weekly update

Milkshake is almost ready. If you're interested in testing it out, then sign up below to get exclusive access.