div遮罩层

<template>
  <div>
    <div class="img_div">
      <img src="https://ss0.bdstatic.com/70cFvHSh_Q1YnxGkpoWK1HF6hhy/it/u=1844712564,539435280&fm=26&gp=0.jpg">

      <a href="#">
        <div class="mask">
          <h3>A Picture of food</h3>
        </div>
      </a>
    </div>
  </div>
</template>

<script>
export default {
  name: 'MfwManageWebRes'
}
</script>

<style lang="less" scoped>
.img_div {
  margin: 20px 400px 0 400px;
  position: relative;
  width: 531px;
  height: 354px;
}
.mask {
  position: absolute;
  top: 0;
  left: 0;
  width: 531px;
  height: 354px;
  background: rgba(101, 101, 101, 0.6);
  color: #ffffff;
  opacity: 0;
}
.mask h3 {
  text-align: center;
}
.img_div a:hover .mask {
  opacity: 1;
}
</style>

  

posted @ 2020-07-17 16:04  青竹玉简  阅读(42)  评论(0编辑  收藏