html - Putting the image behind the background -
i have simple html, i'm not sure if want (the way want it) possible..
<div class="container"> <img src="..." /> </div>
.container has sort of gradient background, in case common black bottom text
background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7));
this simulated in http://jsfiddle.net/9wql6/
i want dark bottom in front of picture, not behind it.
i can't use background-image
image because css precompiled.
is possible?
another way go pseudo-element (ie8+)
css
.container{ max-width: 200px; border: 1px solid black; position: relative; } .container img{ max-width: 200px; } .container:after { position: absolute; content:" "; top:0; left:0; height:100%; width:100%; background: -webkit-gradient(top, from(rgba(255, 255, 255, 0)), color-stop(0.65, rgba(255, 255, 255, 0.7)), color-stop(1, rgba(47, 39, 39, 0.5))); background: -webkit-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); background: -moz-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); background: -ms-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); background: -o-linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); background: linear-gradient(top, rgba(255, 255, 255, 0) 65%, rgba(47, 39, 39, 0.7)); }
Comments
Post a Comment