边框中间添加文字(边框线在文字两边横穿文字)vue elementui

边框中间添加文字

(边框线在文字两边横穿文字)

方法:给文字区域定义一个长和宽,然后让其背景是白色,再把文字移动到相应的位置就可以

具体效果如下:

代码如下:

<template>
  <div class="border">
    <div class="border-title">
      <span>我的消息:</span>
      <span>10</span>
    </div>
  </div>
</template>
<style scoped lang="less">
.border {
  width: 700px;
  height: 200px;
  margin-top: 30px;
  margin-left: 20px;
  border: 2px solid black;
  border-radius: 4px;
}
.border-title {
  width: 110px;
  height: 30px;
  background: white;
  text-align: center;
  margin-top: -12px;
  margin-left: 10px;
}
</style>

猜你喜欢

转载自blog.csdn.net/wulikunbing/article/details/128201825