Reputation: 2589
I have a <div class="wrapper">
with a background image.
Inside of that I have a <div class="inner">
which is 100% height and width.
I want to giver .inner
a radial background which originates from the top left corner.
I can position it with background-position: value;
but the width of .wrapper
will vary depending on screen size.
HTML
<div class="wrapper">
<div class="inner">
<h3>title</h3>
</div>
</div>
CSS
.wrapper {
background-image:url('www.example.com/example.png')
}
.inner {
background: -moz-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%); /* FF3.6-15 */
background: -webkit-radial-gradient(center, ellipse cover, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* Chrome10-25,Safari5.1-6 */
background: radial-gradient(ellipse at center, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%); /* W3C, IE10+, FF16+, Chrome26+, Opera12+, Safari7+ */
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 ); /* IE6-9 fallback on horizontal gradient */
}
Upvotes: 1
Views: 1804
Reputation: 6263
Is this what you want to accomplish:
body {
width: 100%;
height: 100%;
margin: 0;
}
.wrapper {
position: absolute;
height: 100%;
width: 100%;
background: url(https://pixabay.com/static/uploads/photo/2016/01/11/22/05/background-1134468_960_720.jpg) top left no-repeat;
background-size: cover;
}
.inner {
position: absolute;
padding: 15px;
width: 100%;
height: 100%;
box-sizing: border-box;
background: -moz-linear-gradient(-45deg, rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
background: -webkit-linear-gradient(-45deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
background: linear-gradient(135deg, rgba(255,255,255,1) 0%,rgba(255,255,255,0) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#ffffff', endColorstr='#00ffffff',GradientType=1 );
}
<div class="wrapper">
<div class="inner">
<h3> title </h3>
</div>
</div>
Upvotes: 3