Q
在CSS
0
A
回答
3
您可以使用:before
和:after
伪 - 班这样的:
div {
position: relative;
width: 100px;
height: 100px;
margin: 20px;
border: 1px solid #000;
}
div:after {
display: block;
content: "";
width: 20px;
height: 20px;
position: absolute;
top: -5px;
right: -5px;
border-top: 3px solid blue;
border-right: 3px solid blue;
}
span:before {
display: block;
content: "";
width: 20px;
height: 20px;
position: absolute;
bottom: -5px;
left: -5px;
border-bottom: 3px solid orange;
border-left: 3px solid orange;
}
<div><span></span></div>
+0
这是工作,感谢很多 – silvadori
1
试试这个
div{
box-sizing:border-box;
}
div.outer{
height:150px;
width:150px;
position:relative;
background:#fff;
padding:2px;
}
div.inner {
border:1px solid #d6d6d6;
height:100%;
width:100%;
}
div.outer:before{
content:"";
background:#F87200;
width:25px;
height:25px;
position:absolute;
bottom:-5px;
left:-5px;
display:block;
z-index: -1;
}
div.outer:after{
content:"";
background:#0092D4;
width:25px;
height:25px;
position:absolute;
top:-5px;
right:-5px;
display:block;
z-index: -1;
}
<div class="outer">
<div class="inner"></div>
</div>
2
如果你“之后”只需要一个HTML标签,即元素去“前”使用和。在这种情况下最外层的div,并调用此元素前后的元素。额外的标签加在渲染器负载上。
div {
position: relative;
width: 100px;
height: 100px;
margin: 20px;
border: 1px solid #bbb;
}
div:after {
display: block;
content: "";
width: 20px;
height: 20px;
position: absolute;
top: -5px;
right: -5px;
border-top: 3px solid blue;
border-right: 3px solid blue;
}
div:before {
display: block;
content: "";
width: 20px;
height: 20px;
position: absolute;
bottom: -5px;
left: -5px;
border-bottom: 3px solid red;
border-left: 3px solid red;
}
<div></div>
相关问题
- 1. 在CSS中引用CSS
- 2. 在CSS
- 3. 在CSS
- 4. 在CSS
- 5. 在CSS
- 6. 在CSS
- 7. 在CSS
- 8. 在CSS
- 9. 在CSS
- 10. 在CSS
- 11. 在CSS
- 12. 在CSS
- 13. 在CSS
- 14. 在CSS
- 15. 在CSS
- 16. 在css
- 17. 在具有在CSS
- 18. 请在CSS
- 19. modalDialog未在CSS
- 20. CSS:在中间
- 21. 问题在CSS
- 22. 问题在CSS
- 23. CSS在H1
- 24. 两个在CSS
- 25. 标题在CSS
- 26. 如何在CSS
- 27. 在CSS圆
- 28. CSS在IE
- 29. CSS在IE7
- 30. 如何在CSS
你想要做什么是什么呢?详细解释或者你可以谷歌自己 –
这里有一个解决方案,你可以根据它:http://stackoverflow.com/questions/4131490/any-way-to-limit-border-length – Separatrix