2014-11-08 78 views
0

我爲我的客戶開發一個html/css模板。這裏有一個post div,其中的類名是:single_post_box。 在這個div slyle就像波紋管:如何通過css或css3在一個div標籤上做兩個邊框?

single_post_box{ 
border: 1px solid #eaeaea; 
} 

現在我的客戶想要的,就會有兩個邊界。第一個邊框顏色將:#eaeaea &第二個邊框顏色將:#dddddd。 我該怎麼做。

+0

使用'箱shadow'和' – talkhabi 2014-11-08 08:18:26

+0

感謝border'在一起@ Damon.s – 2014-11-08 08:24:42

回答

3

你可以使用僞元素這樣做

.double { 
    background-color: #ccc; 
    border: 4px solid #fff; 
    padding: 20px; 
    width: 200px; 
    height: 300px; 
    position: relative; 
} 
.double:before { 
    background: none; 
    border: 4px solid #666; 
    content: ""; 
    display: block; 
    position: absolute; 
    top: 4px; 
    left: 4px; 
    right: 4px; 
    bottom: 4px; 
} 

你可以檢查這個答案CSS: Double border with different color

1

那麼你可以添加以下來獲得同樣的效果

div{ 
 

 
border :1px dashed red; 
 
outline : 3px dashed blue; 
 
}
<div> this is me </div>

+0

感謝ü。我知道了。 – 2014-11-08 08:25:11

2

只是添加到您的風格,我想你想用不同的顏色一個div

box-shadow: red 0px 0px 0px 2px, green 0px 0px 0px 4px; 
相關問題