我已经查看了大量与我的问题相关的帖子,但没有人真正拥有相同的 html,所以我无法真正弄清楚。
我正在尝试将我的 tumblr 博客的帖子背景设为半透明,而不将帖子上的照片、视频、文本等设为透明。现在我有
#left-column .post {
opacity: 0.5;
filter: alpha(opacity=50);
z-index: -1;
background: #fff;
border: 1px solid #ccc;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
float: left;
padding-top: 20px;
width: 520px;
}
我确定我需要为这个问题提供更多代码。如果您有任何要求,我会复制/粘贴到此处。另外,我只知道 html/css 的基础知识,所以如果我不能马上理解某些东西,我会提出一两个问题。谢谢。
最佳答案
使用 RGBa(红绿蓝 Alpha)
background-color: rgba(255,255,255,0.5);
所以你的代码会是
#left-column .post {
z-index: -1;
background-color: rgba(255,255,255,0.5);
border: 1px solid #ccc;
border-radius: 5px;
-moz-border-radius: 5px;
-webkit-border-radius: 5px;
float: left;
padding-top: 20px;
width: 520px;
}
关于html - 如何在不使内容透明的情况下使帖子背景半透明?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/17938521/