我想獲得這樣的: The Target & How it looks like 的事情是,我的代碼是這樣的:獨立元素的背景不透明度從它的內容不透明
HTML
<body>
<header>
<nav>
<h1>whiterose</h1>
<ul>
<li><a href="">home</a></li>
<li><a href="">us</a></li>
<li><a href="">contact</a></li>
</ul>
</nav>
</header>
CSS:
header {
background: #5d5e62;
color: #ffffff;
font-size: 110%;
height: 7vh;
width: 100%;
opacity: 0.7;
position: fixed;
overflow: auto;
}
header h1 {
margin-left: 5%;
padding: 0.5% 0;
letter-spacing: -2px;
display: inline;
}
header nav {
display: inline;
overflow: auto;
}
header nav ul {
display: inline;
margin-left: 55%;
}
header nav ul li{
list-style-type: none;
color: #ffffff;
padding: 0 0.3%;
display: inline;
}
header nav ul li a {
text-decoration: none;
color: #ffffff;
font-weight: bold;
font-size: 200%;
}
那麼爲什麼即使我將父元素添加到父項元素(標題)他們仍然應用不透明屬性?
你希望你的文字爲0.7不透明度。那是對的嗎? –
根據目標圖像,文字處於完全不透明狀態且背景爲不透明0.7 – anurupr
我希望標題具有不透明度,例如「0.7」但文字仍然不透明1.0。 – Esteban