我似乎无法弄清楚如何在响应文本周围放置角线边框。
我尝试使用绿色边角实现的屏幕截图: 这是文本所在的域。
div {
position: relative;
width: 380px;
height: 0px;
margin: 6px;
}
div:after {
display: block;
content: "";
width: 75px;
height: 75px;
position: absolute;
top: -5px;
right: -5px;
border-top: 4px solid green;
border-right: 4px solid green;
}
a p:before {
display: block;
content: "";
width: 75px;
height: 75px;
position: absolute;
bottom: -70px;
left: -6px;
border-bottom: 4px solid green;
border-left: 4px solid green;
}
h1 {
display: inline-block;
position: relative;
padding: 10px;
}
h1:before,
h1:after {
height: 14px;
width: 14px;
position: absolute;
content: '';
}
h1:before {
right: 0;
top: 0;
border-right: 3px solid #9b59b6;
border-top: 3px solid #9b59b6;
}
h1:after {
left: 0;
bottom: 0;
border-left: 3px solid black;
border-bottom: 3px solid black;
}
<h1>TEXT</h1>
绝对定位和height & width
中before
和after
是关键。
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句