div.body {
width: 80%;
min-height: 100.35%;
float: center;
background-color: black;
filter: alpha(opacity=30);
-moz-opacity: 0.3;
-khtml-opacity: 0.3;
opacity: 0.3;
margin: 0 auto;
overflow: auto;
height: 100%;
margin-top: -1%;
}
这就是我的主 div 中的内容。我希望此 div 中的某些内容不透明。我可以吗?
最佳答案
您可以使用 rgba 将不透明度应用于背景:
div.body {
width: 80%;
min-height: 100.35%;
float: center;
background-color: rgba(0,0,0,.3);
filter: alpha(opacity=30);
margin: 0 auto;
overflow: auto;
height: 100%;
margin-top: -1%;
}
关于html - 如果我设置了我的 div 不透明度,我可以做一些不透明的东西吗?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18083323/