html - CSS3 gradient for background-image opacity -


i have background image hero element on website i'm working on. want make background image in .hero div on gradient transparency complete opacity on edges backgrounds of both divs blend each other.

to illustrate, here's code i'm using right in body of index.html:

<div class="hero">     <div class="hero-inner">          <h1>my awesome hero element</h1>     </div> </div> 

... , what's in style.css

.hero {     background-color: black;     width: 800px; }  .hero-inner {     width: 700px;     height: 200px;     margin: auto;     background-image: url('http://i.imgur.com/pxzvxmr.png'); } .hero-inner h1 {     position: absolute;     font-family: arial, sans-serif;     color: white;     padding: 10px;     background-color: rgba(0, 0, 0, 0.7);     left: 50px;     top: 20px;     font-size: 48px; } 

here's jsfiddle. how make background image in .hero-inner blend in background color of .hero on edges? i've got similar effect on photoshop job i'd know if done css3 gradients

you can draw radial background gradient, code ugly , looks heavy.

here gradient editor may useful: http://www.colorzilla.com/gradient-editor/

background: -moz-radial-gradient(center, ellipse cover, rgba(255,48,48,1) 23%, rgba(205,57,71,1) 40%, rgba(80,79,130,0) 83%, rgba(30,87,153,0) 100%); background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(23%,rgba(255,48,48,1)), color-stop(40%,rgba(205,57,71,1)), color-stop(83%,rgba(80,79,130,0)), color-stop(100%,rgba(30,87,153,0))); background: -webkit-radial-gradient(center, ellipse cover, rgba(255,48,48,1) 23%,rgba(205,57,71,1) 40%,rgba(80,79,130,0) 83%,rgba(30,87,153,0) 100%); background: -o-radial-gradient(center, ellipse cover, rgba(255,48,48,1) 23%,rgba(205,57,71,1) 40%,rgba(80,79,130,0) 83%,rgba(30,87,153,0) 100%); background: -ms-radial-gradient(center, ellipse cover, rgba(255,48,48,1) 23%,rgba(205,57,71,1) 40%,rgba(80,79,130,0) 83%,rgba(30,87,153,0) 100%); background: radial-gradient(ellipse @ center, rgba(255,48,48,1) 23%,rgba(205,57,71,1) 40%,rgba(80,79,130,0) 83%,rgba(30,87,153,0) 100%); filter: progid:dximagetransform.microsoft.gradient( startcolorstr='#ff3030', endcolorstr='#001e5799',gradienttype=1 ); 

Comments

Popular posts from this blog

c# - Send Image in Json : 400 Bad request -

jquery - Fancybox - apply a function to several elements -

An easy way to program an Android keyboard layout app -