javascript - CSS: Text overlay on images while hover -
i've read several tutorials , forums include , other sources on how create hover state description overlay on images. have created version of it. there 1 problem: not responsive (or breaks gracefully).
<div class="section"> <ul> <li> <div> <p><b>1 unit mathematics extension</b></p> <img src="img/thumbnail.png" alt="thumbnail"> <p id="overlay">placerat massa ut est, in, .</p> </div> </li> </ul> </div>
note*: reason why have in list on desktop , tablet view want 3 images appear across page.
my relevant css is:
.section ul{ list-style-type: none; width: 100%; margin: 0; padding: 0; } .section li{ width: 100%; padding-bottom: 30px; } .section img{ width:90%; } #overlay{ width: 90%; position: relative; left: 5%; bottom: 127px; color: white; background: rgba(0, 0, 0, 0.7); }
my problem #overlay css, im trying align bottom of overlay bottom edge of image. when percentage e.g. bottom: x% not work, forces me use fixed px. when this, based on width of window height of overlay changes , results in bottom edge of overlay not aligned bottom of edge.
is there way work around using css , html only?
if able provide input appreciated it!
thank in advanced.
use z-index
#overlay
#overlay{ width: 90%; position: relative; bottom: 50px; color: white; background: rgba(0, 0, 0, 0.7); z-index:1; }
check demo , expand , collapse result window know reponsiveness
Comments
Post a Comment