Corner design in css [duplicate]

橙三吉。 提交于 2020-01-17 04:13:10

问题


I have this image and I am wondering how to get this design. How to design the highlighted borders in CSS and html.


回答1:


Use a couple of pseudo elements and create triangles with their borders then position them absolutely to sit where you want.

More information on pseudo elements

EXAMPLE

div{
    background:#999;
    height:300px;
    position:relative;
    width:100px;
}
div::before,div::after{
    content:"";
    left:100px;
    position:absolute;
}
div::before{
    border-bottom:20px solid #333;
	border-right:20px solid transparent;
    top:0;
}
div::after{
    border-top:20px solid #333;
	border-right:20px solid transparent;
    bottom:0;
}
<div></div>


来源:https://stackoverflow.com/questions/29803400/corner-design-in-css

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!