我在身体里放了个背景图像。我的菜单也有不同的颜色。我不想看到菜单框中的图像,我如何在CSS中做到这一点?下面是我的密码。
谢谢,
Avi
body{
font-family: sans-serif;
background-image: url("coffee_beans.jpeg");
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.menu{
position: relative;
border: 2px solid red;
max-width: 613px;
width: 100%;
margin: auto;
background-color: rgba(255, 189, 109, 0.395);
}发布于 2022-07-20 04:20:34
也许你可以尝试移除背景颜色α,它不会变成透明的背景.
.menu{
background-color: rgb(255, 189, 109);
}如果必须保持背景色透明,则可以在.menu div上再创建一个层。
body{
font-family: sans-serif;
background-image: url("https://dl.fujifilm-x.com/global/products/cameras/x-t3/sample-images/ff_x_t3_002.JPG");
background-repeat: no-repeat;
background-attachment: fixed;
background-size: cover;
}
.menub{
position: relative;
border: 2px solid red;
max-width: 613px;
width: 100%;
height:100px;
margin: auto;
background-color: white;
}
.menu{
width: 100%;
height:100px;
background-color: rgba(255, 189, 109,0.382);
}<html>
<body>
<div class="menub">
<div class="menu"></div>
</div>
</body>
</html>
https://stackoverflow.com/questions/73045853
复制相似问题