首页 > 解决方案 > 文字颜色随着透明框褪色

问题描述

我注意到我的文本颜色随着透明框的不透明度一起褪色。但我真的不知道将我的文本与不透明度分开的正确代码是什么。对不起,如果这个问题听起来有点愚蠢。

body {
  background-color: gray;
}

.container {
  position: relative;
  text-align: center;
}

.content {
  position: absolute;
  top: 20%;
  left: 0;
  right: 0;
  background-color: white;
  opacity: 0.3;
  width: 70%;
  margin: auto;
  padding: 5px;
  color: black;
  font-size: 30px;
  font-family: calibri;
  text-align: center;
}
<body>
  <div class="container">
    <div class="content">
      <h3>Welcome to MedCare</h3>
    </div>
  </div>
</body>

标签: htmlcss

解决方案


推荐阅读