|
|

楼主 |
发表于 2022-4-12 13:53
|
显示全部楼层
这个其实是2d的东东,看上去像立体。HTML是两层结构:黑色部分是展示场所,是父层,使用flex布局令所有子元素与其同圆心;圆柱部分用到一个div盒子,是个无边框的矩形,用两个伪元素做顶部部和底部,形状为椭圆。
- <style>
- .mnDiv {
- margin: auto;
- display: flex;
- justify-content: center;
- align-items: center;
- width: 600px;
- height: 500px;
- background: #000;
- }
- .circle {
- position: absolute;
- width: 80px;
- height: 280px;
- background: rgba(160,180,45,.6);
- }
- .circle::before, .circle::after {
- content: '';
- position: absolute;
- width: inherit;
- height: 50px;
- background: rgba(160,180,45,.95);
- border-radius: 50%;
- }
- .circle::before { top: -25px; }
- .circle::after { bottom: -25px; }
- </style>
- <div class="mnDiv">
- <div class="circle"></div>
- </div>
复制代码
|
|