设置div中的内容水平垂直居中以及div背景透明,文字不透明样式。

dom内容:

<div v-if="isclick" class="test_two_box1">
 <span>该网点尚未接通视频监控</span>
</div>

样式内容:

.test_two_box1{
   position: fixed;
   bottom: 0;
   left: 0;
   z-index: 99999;
   width: 300px;
   height: 150px;
   text-align: center;
   line-height: 150px;
   background-color:rgba(0,0,0,0.2);
   border: 1px solid white;
 }
 .test_two_box1 span{
   font-size: 20px;
   color: white;
 }
  1. 设置div中的内容水平垂直居中的样式代码为:text-align: center;line-height: 150px; text-align是设置内容水平居中的,当内容的 line-height 与div的高度相等时就会垂直居中。
  2. 设置div背景透明,文字不透明样式代码为:background-color:rgba(0,0,0,0.2);color: white; 前者设置背景透明,后者设置文字不透明。

最终效果如下:在这里插入图片描述

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值