<template> <div class="circle"> <div v-for="item in 50" class="item" :style="{ transform: `rotate(${item * 3.6}deg)` }"></div> <div class="top"></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: absolute; width: 100%; height: 100%; left: 5%; top: 5%; border-radius: 50%; background-color: rgba(255, 255, 255); } .item { width: 100%; height: 3px; background-color: rgba(255, 255, 255, 0.5); position: absolute; left: 0%; top: 50%; } } </style> 请将以上的class="item"的线条缩短,距离最外层盒子10px
时间: 2024-03-17 12:43:56 浏览: 43
cpp代码-模板 泛型 template<typename> template<class>
可以在`.item`的样式中加上`margin: -1.5px 0 0 -1.5px;`,同时将`.circle`的`border-radius`属性改为`calc(50% - 10px)`,即可将线条缩短并距离最外层盒子10px,修改后的代码如下所示:
```html
<template>
<div class="circle">
<div v-for="item in 50" class="item" :style="{ transform: `rotate(${item * 3.6}deg)` }"></div>
<div class="top"></div>
</div>
</template>
<style lang="less">
.circle {
position: relative;
width: 86%;
height: 86%;
left: 7%;
top: 7%;
border-radius: calc(50% - 10px);
.top {
position: absolute;
width: 100%;
height: 100%;
left: 5%;
top: 5%;
border-radius: 50%;
background-color: rgba(255, 255, 255);
}
.item {
width: 100%;
height: 3px;
background-color: rgba(255, 255, 255, 0.5);
position: absolute;
left: 0%;
top: 50%;
margin: -1.5px 0 0 -1.5px;
}
}
</style>
```
阅读全文