html - How to hover a whole element to show details -
html - How to hover a whole element to show details -
i'm creating 'portfolio' section has 2 thumbnails, first 1 @ top of block , sec @ bottom.
this want: http://i.imgur.com/prenipv.png
jsfiddle
there problem hovering on image placed @ bottom, has margin-top: 200px
when hover removed margin-top:0;
not want, create hover effect whole element, if hove either image on top or image on bottom, hover effect activates.
if guys give me improve construction valids arguments can alter mine :)
i leave html , css below guys can help me figure out how solve this.
html:
<div class="col-lg-3"> <div class="portfolio-item"> <a class="portfolio-image" href="#"> <div class="portfolio-image-one"> <img src="../img/portfolioweb/1.jpg" alt="thumbnail" /> </div> </a> <a class="portfolio-info" href="#"> <div class="portfolio-logo-one"> <img src="../img/portfolioweb/1l.jpg" alt="logo" /> </div> <p class="porfolio-brief-info">lorem ipsum dolor sit down amet, consectetur adipisicing elit. temporibus nam nobis consectetur.</p> <p class="portfolio-info-link">learn more</p> </a> </div> </div>
the css:
.portfolio-web { background: #f5f5f5; padding: 20px 0; } .portfolio-container { margin: 40px 0; } .portfolio-tagline { font-family: 'oswald', arial, sans-serif; font-size: 3em; font-weight: 400; text-transform: uppercase; text-align: center; margin: 30px 0; } .portfolio-item { background: white; width: 100%; height: 280px; margin-top: 20px; overflow: hidden; position: relative; vertical-align: top; } .portfolio-image { cursor: default; } .portfolio-image-one { width: 100%; height: 200px; } .portfolio-info { background: white; margin-top: 200px; position: absolute; left: 0; top: 0; height: 280px; text-align: center; text-decoration: none; transition: 0.5s ease; } .portfolio-info:hover { margin-top: 0; text-decoration: none; } .portfolio-logo-one { width: 100%; height: 80px; vertical-align: middle; } .porfolio-brief-info { color: #909090; font: 13px/20px 'open sans', arial, sans-serif; margin: 0; padding: 10px; } .portfolio-info-link { color: #ff8e01; font: 14px/20px 'open sans', arial, sans-serif; padding: 10px; font-weight: bold; }
thank you.
for achieving hover effect on whole element, can utilize css combinator:
.portfolio-item:hover > .portfolio-info { margin-top: 0; text-decoration: none; }
instead of
.portfolio-info:hover { margin-top: 0; text-decoration: none; }
html css
Comments
Post a Comment