灰度图像上方的渐变 css
Gradient above of gray scale image css
我有以下代码,一个灰度背景图像和包含该图像的 div,它具有渐变。
我遇到的问题是渐变也出现在灰度中。
我需要渐变在灰度图像之上。
有什么想法吗?
<div id="contentVisi" class="overlaySeg"></div>
#contentVisi {
background-image: url("images/visitantes.jpg");
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 586px;
-webkit-filter: grayscale(100%);
}
.overlaySeg::before {
background: -moz-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -webkit-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -o-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -ms-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: radial-gradient(circle at 74% 27%, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e34f78', endColorstr='#e34f78', GradientType=1 );
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 586px;
content: '';
position: absolute;
opacity: 0.6;
top: 0;
z-index: 3;
}
将您的 div 包裹在另一个 div 中,然后将彩色渐变添加到 div 中。
HTML:
<div class="overlaySeg"><div id="contentVisi"></div></div>
CSS:
#contentVisi {
background-image: url("http://s3.amazonaws.com/colorcombos-images/users/1/color-schemes/color-scheme-375-main.png?v=20120505082910");
background-repeat: no-repeat;
background-size: cover;
width: 487px;
height: 290px;
-webkit-filter: grayscale(100%);
}
.overlaySeg {
position:relative;
display:inline-block;
}
.overlaySeg:after {
background: -moz-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -webkit-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -o-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -ms-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: radial-gradient(circle at 74% 27%, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e34f78', endColorstr='#e34f78', GradientType=1 );
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
content: '';
position: absolute;
opacity: 0.6;
top: 0;
z-index: 3;
}
Codepen 演示:http://codepen.io/saqibamin/pen/jWGJEB
我有以下代码,一个灰度背景图像和包含该图像的 div,它具有渐变。
我遇到的问题是渐变也出现在灰度中。
我需要渐变在灰度图像之上。
有什么想法吗?
<div id="contentVisi" class="overlaySeg"></div>
#contentVisi {
background-image: url("images/visitantes.jpg");
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 586px;
-webkit-filter: grayscale(100%);
}
.overlaySeg::before {
background: -moz-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -webkit-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -o-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -ms-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: radial-gradient(circle at 74% 27%, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e34f78', endColorstr='#e34f78', GradientType=1 );
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 586px;
content: '';
position: absolute;
opacity: 0.6;
top: 0;
z-index: 3;
}
将您的 div 包裹在另一个 div 中,然后将彩色渐变添加到 div 中。
HTML:
<div class="overlaySeg"><div id="contentVisi"></div></div>
CSS:
#contentVisi {
background-image: url("http://s3.amazonaws.com/colorcombos-images/users/1/color-schemes/color-scheme-375-main.png?v=20120505082910");
background-repeat: no-repeat;
background-size: cover;
width: 487px;
height: 290px;
-webkit-filter: grayscale(100%);
}
.overlaySeg {
position:relative;
display:inline-block;
}
.overlaySeg:after {
background: -moz-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -webkit-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -o-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: -ms-radial-gradient(74% 27%, circle cover, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
background: radial-gradient(circle at 74% 27%, rgba(227,79,120,0) 0%, rgba(227,79,120,0.29) 29%, rgba(227,79,120,0.61) 61%, rgba(227,79,120,1) 100%);
filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#e34f78', endColorstr='#e34f78', GradientType=1 );
background-repeat: no-repeat;
background-size: cover;
width: 100%;
height: 100%;
content: '';
position: absolute;
opacity: 0.6;
top: 0;
z-index: 3;
}
Codepen 演示:http://codepen.io/saqibamin/pen/jWGJEB