gpt4 book ai didi

css透明体不包括图像

转载 作者:太空宇宙 更新时间:2023-11-04 03:05:54 26 4
gpt4 key购买 nike

我有这个代码

    body {
background-color: #808080;
background-image: url('/Content/img/emboss.png');
background-repeat: no-repeat;
background-position: center 250px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 10pt;
opacity: 0.8;
}
img {
opacity: 1;
}

但是它不起作用。整个网站,每个元素的不透明度都是 0.8,这正是我想要的,而且看起来很完美。但是,在渲染图像时我不需要任何透明度。

我将如何在我的 CSS 中执行此操作

最佳答案

您可以使用一些小技巧来实现。使用 :not 伪选择器,如下所示。

 body {
background-color:#808080;
background-image: url('/Content/img/emboss.png');
background-repeat: no-repeat;
background-position: center 250px;
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Geneva, Verdana, sans-serif;
font-size: 10pt;
}
body :not(img)
{
opacity:0.7;
}

DEMO

关于css透明体不包括图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30474255/

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