vue修改:after伪元素样式
<template><div class="test"><span :style="spanStyle" class="span1">hello world</span><br><span :style="{'--width': widthVar}" class="span2">hello earth</span>
·
<template>
<div class="test">
<span :style="spanStyle" class="span1">hello world</span>
<br>
<span :style="{'--width': widthVar}" class="span2">hello earth</span>
</div>
</template>
<script>
export default {
data() {
return {
spanStyle: {
"--color": "red"
},
widthVar: "100px"
};
}
}
</script>
<style scoped>
.span1 {
color: var(--color);
}
.span2 {
text-align: center;
position: relative;
}
.span2::after {
content: '';
display: block;
position: absolute;
left: 100%;
width: var(--width);
height: var(--width);
border-radius: 50%;
border: 2px solid black;
}
</style>
更多推荐
已为社区贡献2条内容
所有评论(0)