html - image viewer using css is not working -
hello friends,
i trying develop simple image viewer can see in given picture want when user hover on black box red box appear got problem on last div when user hover on last div red div going outside please me . there way solve using css
only. please see code
css
div{float:left; text-align:center; font-size:16px; color:#404040; margin:0 30px 20px 30px; position:relative; .viewer{ position:absolute; width:300px; background:red; height:400px; top:20px; left:110px; }
thanks in advance .. :)
i redid you. try , should good. looks have relative , absolute positioning mixed up.
html
<!-- begin image hover --> <ul class="enlarge"> <!-- first image --> <li> <img src="image.jpg" width="150px" height="100px" alt="dechairs" /><span><img src="image.jpg" alt="deckchairs" /><br />deckchairs on blackpool beach</span> </li> <!-- second image --> <li> <img src="image.jpg" width="150px" height="100px" alt="blackpool sunset" /><span><img src="image.jpg" alt="blackpool sunset" /><br />sunset on irish sea @ blackpool</span> </li> <!-- third image --> <li> <img src="image.jpg" width="150px" height="100px" alt="blackpool pier" /><span><img src="image.jpg" alt="blackpool pier" /><br />rolling waves off blackpool north pier</span> </li> </ul> <!-- end image hover -->
and css...
ul.enlarge{ list-style-type:none; /*remove bullet point*/ margin-left:0; } ul.enlarge li{ display:inline-block; position: relative; z-index: 0; margin:10px 40px 0 20px; } ul.enlarge img{ background-color:#eae9d4; padding: 6px; -webkit-box-shadow: 0 0 6px rgba(132, 132, 132, .75); -moz-box-shadow: 0 0 6px rgba(132, 132, 132, .75); box-shadow: 0 0 6px rgba(132, 132, 132, .75); -webkit-border-radius: 4px; -moz-border-radius: 4px; border-radius: 4px; } ul.enlarge span{ position:absolute; left: -9999px; background-color:#eae9d4; padding: 10px; font-family: 'droid sans', sans-serif; font-size:.9em; text-align: center; color: #495a62; -webkit-box-shadow: 0 0 20px rgba(0,0,0, .75)); -moz-box-shadow: 0 0 20px rgba(0,0,0, .75); box-shadow: 0 0 20px rgba(0,0,0, .75); -webkit-border-radius: 8px; -moz-border-radius: 8px; border-radius:8px; } ul.enlarge li:hover{ z-index: 50; cursor:pointer; } ul.enlarge span img{ padding:2px; background:#ccc; } ul.enlarge li:hover span{ top: -300px; left: -20px; } ul.enlarge li:hover:nth-child(2) span{ left: -100px; } ul.enlarge li:hover:nth-child(3) span{ left: -200px; } /**ie hacks - see http://css3pie.com/ more info on how use cs3pie , download latest version**/ ul.enlarge img, ul.enlarge span{ behavior: url(pie/pie.htc); }
here's jsfiddle can see how works...
Comments
Post a Comment