考慮以下樣式:
<template>
<!-- Some Tags -->
<div class="mb-8 w-full">
<span class="subline"></span>
</div>
</template>
.
.
.
<style scoped lang="scss">
.subline {
border-bottom: dashed 2px #eee;
display: block;
}
.subline::before { /* Not working ! */
width: 30px;
height: 20px;
z-index: 99999;
border-bottom: dashed 2px green;
position: fixed;
bottom: 0;
left: 0;
}
</style>
我需要使用::before但不起作用!
我怎樣才能做到這一點?
uj5u.com熱心網友回復:
偽元素需要一個content屬性可見,添加content: ""來解決這個問題
.subline::before {
content: "";
width: 30px;
height: 20px;
z-index: 99999;
border-bottom: dashed 2px green;
position: fixed;
bottom: 0;
left: 0;
}
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/337343.html
