CSS/HTML:应用于背景颜色的 Alpha 设置使其消失

CSS/HTML: Alpha setting applied to background-color makes it disappear

系统:Linux铸币厂 编辑:Atom(作者 GitHub) 浏览器:Google Chrome for Linux (43.0)

问题:为了在我的代码的 CSS 部分中设置 class biobox 的 div 的样式,我试图通过使用 background-color 获得半透明背景:RGB(0,0,0,0.5)。这导致根本没有背景。如果我删除 0.5(alpha/transparency.opacity 值),我会得到应用于 div 的不透明黑色背景。可能是什么原因造成的?

h1 {
  font-famiy: Verdana;
  color: #090956;
}
.biobox {
  font-family: cursive;
  background-color: rgb(0, 0, 0, 0.3);
  color: #090956;
  margin: 20px;
  padding: 20px;
}
body {
  background: url('bg.jpg') no-repeat center center fixed;
  -webkit-backgound-size: cover;
  -moz-background-size: cover;
  -o-background-size: cover;
  background-size: cover;
}
 <h1>This is Big Header</h1>

<div class="biobox">
  <p>This is a subtitle to the header!</p>
</div>

<p>More bio crap!</p>

您需要使用 rgba(0, 0, 0, 0.3); 而不是 rgb(0, 0, 0, 0.3);