【发布时间】:2019-09-26 12:30:43
【问题描述】:
如何用 CSS 制作 4 个角的几何对象?
body {
background: #d0d0d0;
}
.select {
width: 60px;
height: 60px;
background: white;
display: block;
position: relative;
}
<div class="select">
<div style=" height: 2px; width: 15%; background: red; position: absolute; top: 0; "></div>
<div style=" height: 15%; width: 2px; background: red; position: absolute; top: 0; "></div>
<div style=" height: 2px; width: 15%; background: red; position: absolute; bottom: 0; "></div>
<div style=" height: 15%; width: 2px; background: red; position: absolute; bottom: 0; "></div>
<div style=" height: 2px; width: 15%; background: red; position: absolute; right: 0; top: 0; "></div>
<div style=" height: 15%; width: 2px; background: red; position: absolute; right: 0; top: 0; "></div>
<div style=" height: 2px; width: 15%; background: red; position: absolute; bottom: 0; right: 0; "></div>
<div style=" height: 15%; width: 2px; background: red; position: absolute; bottom: 0; right: 0; "></div>
</div>
【问题讨论】:
-
您能发布一些代码并展示您还尝试过什么吗?
-
如果你想要一些动画:stackoverflow.com/a/55647261/8620333