3
我想要使用CSS:在元素#text後,但沒有#文本的背景繼續顯示後面的元素,因爲我需要它是透明的。我不能僅僅將after元素的背景改爲#000,因爲這只是一個例子,我還應該通過它來展示其他的東西。我的代碼如下。CSS:後沒有元素背景
HTML:
<div id="text">
<div class="news">This is some sample text.</div>
</div>
<div id="logo"></div>
CSS:
body {
background: #000;
margin: 0;
}
#logo {
position: relative;
float: left;
background: #FFFFFF;
width: 25%;
height: 80px;
line-height: 80px;
border: 1px solid #a0a4b0;
border-top: 0;
border-radius: 0 0 8px 8px;
text-align: center;
box-sizing: border-box;
}
#text {
position: relative;
background: #FFFFFF;
border: 1px solid #a0a4b0;
border-width: 0 1px 0 1px;
padding: 5px 30px 15px;
z-index: 100;
line-height: 1.1;
}
#text:after {
content: " ";
position: absolute;
bottom: -1px;
right: 1px;
width: 75%;
box-sizing: border-box;
height: 8px;
border: 1px solid #a0a4b0;
border-width: 1px 0 0 1px;
border-radius: 8px 0 0 0;
}
我不明白,爲什麼你不能只是將背景設置爲一些RGBA顏色? – Charles 2014-09-30 20:09:30