jquery - Adjusting image description bar of resizable image with CSS -
i need responsive image resizes maximum of given area. works fine code below. need show description of image @ bottom of image. want description bar fill bottom of image , animated bottom when hover on image.
i'm adding picture of want achieve better understanding. think placing , sizing of description bar should possible using html , css don't know how. goal description
i suppose animation of description bar need use javascript animation great if knew solution css animation transform trick.
html, body { width: 100%; height: 100%; } img { max-width: 100%; max-height: 100%; } .description { border: #093 medium solid; width: 100%; height: 40px; overflow: hidden; position: absolute; bottom: 0px; } .imagecontainer { height: 100%; width: 100%; position: relative; }
<div class="imagecontainer"> <img src=".."> <div class="description"> inserted description </div> </div>
try update code way.
html, body { width: 100%; height: 100%; font-size: 0; } img { max-width: 100%; max-height: 100%; } .imagecontainer { width: 100%; height: 100%; position: relative; overflow: hidden; display: inline; } .description { width: 100%; height: 0px; overflow: hidden; position: absolute; bottom: 0px; background-color: rgba(0, 0, 0, 0.7); font-size: 16px; -ms-filter: "progid: dximagetransform.microsoft.alpha(opacity=0)"; filter: alpha(opacity=0); opacity: 0; -webkit-transition: 1s ease-in-out 0.5s; -moz-transition: 1s ease-in-out 0.5s; -o-transition: 1s ease-in-out 0.5s; -ms-transition: 1s ease-in-out 0.5s; transition: 1s ease-in-out 0.5s; } img:hover~.description { height: 40px; -ms-filter: "progid: dximagetransform.microsoft.alpha(opacity=100)"; filter: alpha(opacity=100); opacity: 1; -webkit-transition-delay: 0s; -moz-transition-delay: 0s; -o-transition-delay: 0s; -ms-transition-delay: 0s; transition-delay: 0s; }
<div class="imagecontainer"> <img src="http://p1.pichost.me/i/9/1321574.jpg"> <div class="description" style="color: gray"> inserted description </div> </div>
.imagecontainer
has display set inline, because want .description
flow on image only. that's why have set html, body
's font-size zero, otherwise .description
overflow image bit.
Comments
Post a Comment