html - Any ideas on how to add a transparent gradient to an image using css? -


this question has answer here:

i wondering if knew if possible make edges of image transparent using css? know can done background image , use method on site. hoping make sides , bottom of images contained in slide show transparent fade background. don't want have each image individually in photoshop , hoping find reliable method using css or javascript. time , help.

yes... can this:

.mask {    background: -moz-linear-gradient(top,  rgba(255,255,255,0) 0%, rgba(255,255,255,1) 100%); /* ff3.6+ */    background: -webkit-gradient(linear, left top, left bottom, color-stop(0%,rgba(255,255,255,0)), color-stop(100%,rgba(255,255,255,1))); /* chrome,safari4+ */    background: -webkit-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* chrome10+,safari5.1+ */    background: -o-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* opera 11.10+ */    background: -ms-linear-gradient(top,  rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* ie10+ */    background: linear-gradient(to bottom,  rgba(255,255,255,0) 0%,rgba(255,255,255,1) 100%); /* w3c */    filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#00ffffff', endcolorstr='#ffffff',gradienttype=0 ); /* ie6-9 */    z-index: 2;    position: absolute;    left: 0;    width: 100%;    bottom: 0;    height: 50%;  }    .fader {display: inline-block;}  .fader img {position: relative; z-index: 1;}
<div class="fader">    <img src="http://lorempixel.com/400/200/animals/" />    <div class="mask"></div>  </div>


Comments

Popular posts from this blog

javascript - Google App Script ContentService downloadAsFile not working -

javascript - Function overwritting -

php - Find a regex to take part of Email -