<template>
<div>
<div class="content">
盒子
<div class="topUserInfo">
弹窗
</div>
</div>
</div>
</template>
<script>
export default {
}
</script>
<style lang="less" scoped>
.content {
margin-top: 300px;
position: relative;
margin-left: 100px;
border: 1px solid red;
width: 100px;
&:hover {
.topUserInfo {
display: block;
}
}
}
.topUserInfo {
display: none;
width: 220px;
height: 40px;
position: absolute;
top: -50px;
left: 50%;
transform: translate(-50%, 0);
background: #fff;
border: 1px solid #1890ff;
border-radius: 4px;
z-index: 101;
&::before {
position: absolute;
bottom: -5px;
left: calc(50% - 10px);
overflow: hidden;
width: 8px;
height: 8px;
background: #fff;
border-left: 1px solid #1890ff;
border-top: 1px solid #1890ff;
-webkit-transform: rotate(225deg);
-moz-transform: rotate(225deg);
-o-transform: rotate(225deg);
transform: rotate(225deg);
content: '';
}
}
</style>