我想div是透明的,但不是div內的按鈕。任何人都可以幫助我嗎?
#ss {
background-color: black;
width: 1500px;
height: 80px;
overflow-x: 0;
margin-top: -8px;
margin-left: -10px;
opacity: 0.5;
text-align: center;
position: absolute;
}
#as {
background-color: #968f8f;
width: 70px;
height: 40px;
opacity: 1;
margin-top: 15px;
position: relative;
color: white;
border-radius: 4px;
}
#bd {
background-color: grey;
background-image: url("image3.jpg");
overflow-x: hidden;
background-repeat: no-repeat;
background-size: 1315px;
}
<body id="bd">
<div id="ss">
<table>
<tr>
<td>
<button id="as"> Home </button>
</td>
</tr>
</table>
</div>
</body>
的問題是,我想DIV是透明的,但不是在div裏面的按鈕。
的[我不想在CSS的繼承父孩子不透明度]可能的複製(http://stackoverflow.com/questions/5770341/i-do-not-want-to-the-parent-in-css) – Ivar
[透明父項中的非透明子項]的可能重複(http://stackoverflow.com/questions/3031848 /透明子透明父項) –
由於除了按鈕之外,在div中沒有太多可以看到的東西,所以爲什麼不直接放棄不透明度並使用#7F7F7F作爲背景顏色。 –