Jump to content

Recommended Posts

Hi guys,
Please help, my css image enlarge on mouse hover is not behaving. The main div is failing to center even though I have used margin:0 auto; I want it to enlarge image on hover without adjusting other div elements. I would love it to enlarge image with text, tried using javascript but no success.
 
<html> 
<head> 
<style type="text/css">
.myimg {
    position:relative;
    width:50%;
    top:0px;
}


.myimg:hover {
    width:80%;
    z-index:9999;
}


.Enlrg ul {clear:both; list-style-type:none; }


.Enlrg li {width:20%;
float: left;
overflow:visible;
display: block;
}
</style> 
</head> 


<body>


<div style="margin:0 auto; background:gray; width:80%;">
  <div class="Enlrg">
   <ul>
      <li><img class="myimg" src="pic1.jpg" alt="Rocasa Future classroom" /></li>
 <li><img class="myimg" src="pic2.jpg" alt="Rocasa Future classroom" /></li>
 <li><img class="myimg" src="pic3.jpg" alt="Rocasa Future classroom" /></li>
   </ul>
  </div>
</div>

</body></html>

 

 

Link to comment
https://forums.phpfreaks.com/topic/286719-css-javascript-image-hover-on-mouse/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.