gpt4 book ai didi

html - 我怎样才能使图像的不透明中心?

转载 作者:行者123 更新时间:2023-11-28 13:09:01 25 4
gpt4 key购买 nike

我有这样的 HTML:

<div class="box">
<img src="http://2.bp.blogspot.com/-nIyLxGN6a0M/UmJOO_AcS_I/AAAAAAAAAGU/XBab6NjyaiI/s1600/anh4.jpg" />
</div>

使用上面的 HTML 代码,我想要这样的结果。

enter image description here

意思是从图片的中心到边缘,不透明度会越来越小。我想通过颜色控制不透明度,所以我没有添加覆盖图像的 div 来实现这种效果。

我像这样使用 CSS:

.box { //css here.
}

感谢您的帮助。

最佳答案

Fiddle

.box {
position: relative;
width: 95%;
margin: 50px auto;
}
.box > img, .box > div {
max-width: 100%;
}
.vignette {
position: absolute;
top: 0;
left: 0;
bottom: 0;
right: 0;
z-index: 1;
background: -moz-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 1) 100%);
/* FF3.6+ */
background: -webkit-gradient(radial, center center, 0px, center center, 100%, color-stop(0%, rgba(255, 255, 255, 0)), color-stop(33%, rgba(255, 255, 255, 0)), color-stop(100%, rgba(255, 255, 255, 1)));
/* Chrome,Safari4+ */
background: -webkit-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 1) 100%);
/* Chrome10+,Safari5.1+ */
background: -o-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 1) 100%);
/* Opera 12+ */
background: -ms-radial-gradient(center, ellipse cover, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 1) 100%);
/* IE10+ */
background: radial-gradient(ellipse at center, rgba(255, 255, 255, 0) 0%, rgba(255, 255, 255, 0) 33%, rgba(255, 255, 255, 1) 100%);
/* W3C */
}

关于html - 我怎样才能使图像的不透明中心?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/19470127/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com