我想创建以下div边框: 我将绿色边框部分排序,但不是顶部的红线。有什么想法吗?
到目前为止代码:
#myborder {
border: 4px solid green;
}
答案 0 :(得分:4)
使用此css http://jsfiddle.net/PESHk/3
#myborder {
box-shadow: 0 0 0 4px green, 0 0 0 4px green inset;
border-top:2px solid red;
padding:8px;
}
答案 1 :(得分:2)
致力于Hushme的回答:http://jsfiddle.net/PESHk/2/
#myborder {
box-shadow: 0 0 0 4px green, 0 0 0 4px green inset;
border-top: 2px solid red;
padding: 8px;
}
here使用::before
:
#myborder {
box-shadow: 0px 4px 15px rgba(0,0,0,0.15);
border: 8px solid green;
border-top: 0;
padding: 16px 8px 8px 8px;
position: relative;
}
#myborder::before {
width: 100%;
background: red;
height: 2px;
border: 4px solid green;
content: "";
display: block;
position: absolute;
left: 0;
top: 0;
}