2013-08-27 142 views
0

是否有一些CSS方法使div透明,但邊框不透明?使邊框不透明,如果div是透明的

HTML:

<div class="ts-twentytwelve-description">into quality solutions</div> 

CSS:

border-left: 9px solid #fff; 
border-right: 9px solid #fff; 
background-color: black; 
opacity: 0.86; 
filter: alpha(opacity=86); 
+0

你有沒有試試這個? border-left:9px solid #FFF; background-color:rgba(0,0,0,.86); ? – artSx

回答

2

你可以這樣做:

.ts-twentytwelve-description { 
border-left: 9px solid #fff; 
border-right: 9px solid #fff; 
background-color: rgba(0,0,0,.86); 
} 

使用background-color:rgba(value)可以爲背景顏色添加不透明度。 對於IE你有generator here

0

試試這個:

div { 
    background-color: rgba(0, 0, 0, .5); // or transparent 
    border-color: #fff; 
} 

編輯:

您可以使用此解決方案:

<div class="border_div"> 
    <div class="content_div"> 
     your content here 
    </div> 
</div> 

.border_div { 
    border: 5px solid #fff; 
} 

.content_div { 
    opacity: .86; 
} 
0

這裏是一個工作的jsfiddle:http://jsfiddle.net/q4XVZ/2/

CSS:

.ts-twentytwelve-description { 
border-top: 1px solid #000; 
border-left: 9px solid #000; 
border-right: 9px solid #000; 
border-bottom: 1px solid #000; 
background-color: transparent; 
opacity: 0.86; 
filter: alpha(opacity=86); 
} 

HTML:

<div class="ts-twentytwelve-description">into quality solutions</div>