今天女朋友给我提了个需求,一张图片实现鼠标滑过翻转到背面是介绍图片的内容,代码如下
<template>
<div class="Demo">
<div class="Before" ></div>
<div class="After" style="font-size:20px;color:black">这个是背面的介绍</div>
</div>
</template>
<script>
export default {
name:"fangzhuangdonghua"
}
</script>
<style>
.Demo{
width: 533px;
height: 300px;
margin-top: 300px;
margin-left: 500px;
position: relative;
perspective: 800px;
box-sizing: border-box;
}
.Before{
width: 100%;
height: 100%;
position: absolute;
top:0;
left: 0;
background-repeat: no-repeat;
background-position: center center;
backface-visibility: hidden;
transition: 3s;
background-image:url('../assets/1.jpg');
border:1px solid yellow;
}
.After{
width: 100%;
height: 100%;
position: absolute;
top:0;
left: 0;
color: