【发布时间】:2017-03-17 10:49:59
【问题描述】:
我正在尝试将背景图像设置为 70% 的不透明度,而不影响其前面的文本(在同一个 div 中)。
HTML
#home {
opacity: 0.7;
background-attachment: fixed;
background-position: center;
background-repeat: no-repeat;
background-size: cover;
background-image: url("...");
min-height: 100%;
overflow: hidden;
}
div .welcome {
background-size: cover;
vertical-align: middle;
text-align: center;
font-family: 'Lobster', cursive;
font-weight: 900;
font-size: 60px;
color: black;
margin: auto;
}
<div id="home" class="section">
<p class="welcome"><strong>Hello,<br>My name is Sean</strong></p>
</div>
【问题讨论】:
标签: html css background opacity