<template> <div class="circle"> <div class="top"></div> <div v-for="item in 50" class="item" :style="{ transform: `rotate(${item * 3.6}deg)` }"></div> </div> </template> <script lang="ts" setup> import { transform } from 'ol/proj' </script> <style lang="less"> .circle { position: relative; width: 86%; height: 86%; left: 7%; top: 7%; border-radius: 50%; .top { position: relative; width: 100%; height: 100%; overflow: hidden; left: 5%; top: 5%; border-radius: 50%; background-color: rgba(255, 255, 255, 0); } .item { width: 100%; height: 3px; background-color: rgba(255, 255, 255, 0.5); position: absolute; left: 0%; top: 50%; } } </style> 请将这个盒子中间圆形百分之九十的区域设置为透明,不显示超出线条
时间: 2024-03-17 14:44:02 浏览: 105
可以在`.top`的样式中加上`overflow: hidden;`和`background-color: rgba(255, 255, 255, 0);`,即可将圆形百分之九十的区域设置为透明,不显示超出线条,修改后的代码如下所示:
```html
<template>
<div class="circle">
<div class="top"></div>
<div v-for="item in 50" class="item" :style="{ transform: `rotate(${item * 3.6}deg)` }"></div>
</div>
</template>
<style lang="less">
.circle {
position: relative;
width: 86%;
height: 86%;
left: 7%;
top: 7%;
border-radius: 50%;
.top {
position: relative;
width: 100%;
height: 100%;
overflow: hidden;
left: 5%;
top: 5%;
border-radius: 50%;
background-color: rgba(255, 255, 255, 0);
}
.item {
width: 100%;
height: 3px;
background-color: rgba(255, 255, 255, 0.5);
position: absolute;
left: 0%;
top: 50%;
}
}
</style>
```
阅读全文
相关推荐


















