html - how to put a div above a hover while it does not get removed -
i trying put div above div has been hovered. when on new div mouse, hovered image disappeares..
anyone know how fix this? hover in tie way :)
my website this: my website
the code of hover this:
.vierkant img{ position:absolute; width:116px; height:254px; top:0px; margin:0 auto; margin-left:-58px; opacity:0.91; z-index:3; -webkit-transition-duration: 1.2s; -moz-transition-duration: 1.2s; -o-transition-duration: 1.2s; transition-duration: 1.2s;} .vierkant img:hover{ position:absolute; width:80%; height:95%; top:2%; left:auto; right:auto; margin-left:-40%; visibility:visible; z-index:4; opacity:1;}
and html code this:
<div class="vierkant" align="center"> <img src="img/knoppen/vierkant.jpg" width="90" height="93" /> </div>
i know answer has been accepted, really? using jquery or javascript such simple task way overkill when can done , is done css.
first off, align=""
property in html deprecated. also, why adding top, left, margin, & margin-left
properties? it's pretty useless redefine properties aim achieve same thing (especially when of them don't work because position
isn't relative).
don't use images when want display text on it. instead, use div background-image: url('yourimg.png');
i made fiddle here correct code, removing need javascript, let alone jquery: http://jsfiddle.net/m4uyx/
why solution way way better?
- you don't need image, if background color (as in case)
- you don't need javascript (and more cross-browser)
- you don't need jquery
- you can position text or w/e else without worrying disappearing on
:hover
edit: although not part of original question; center position of div, give these properties:
.vierkant { position: absolute; left: 50%; margin: 0px -58px; /* -58px = width divided 2 in negative */ }
Comments
Post a Comment