css 元素前后添加图标(::before 和 ::after 的妙用)

在这里插入图片描述

<template>
  <div class="container">
    <div class="label">猜你喜欢</div>
  </div>
</template>

<style lang="scss" scoped>
.label {
      
      
  display: flex;
  &::before,
  &::after {
      
      
    content: "";
    width: 20px;
    height: 20px;
    background-image: url(./bubble.png);
    background-size: contain;
    margin: -2px 10px;
  }
}
.container {
      
      
  margin: 30px;
}
</style>

猜你喜欢

转载自blog.csdn.net/weixin_41192489/article/details/134858462