效果图:
CSS
<style>
@import url('https://fonts.googleapis.com/css?family=Poppins:100,200,300,400,500,600,700');
body {
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
font-family: 'Poppins', sans-serif;
height: 100vh;
background: #333;
}
ul {
margin: 0;
padding: 0;
display: flex;
}
ul li {
position: relative;
list-style: none;
width: 20px;
height: 20px;
background: #777;
margin: 0 20px;
border-radius: 50%;
transition: 0.5s;
cursor: pointer;
}
/* 核心代码 */
ul li:hover {
background: #86ff3b;
box-shadow: 0 0 0 4px #333,
0 0 0 6px #86ff3b;
}
ul li .content::before {
content: '';
position: absolute;
width: 30px;
height: 30px;
background: #fff;
bottom: -15px;
left: 194px;
transform: rotate(45deg);
}
ul li .content h2 {
margin: 0;
padding: 0;
}
ul li .content {
position: absolute;
bottom: 55px;
width: 400px;
background: #fff;
padding: 20px;
box-sizing: border-box;
border-radius: 4px;
visibility: hidden;
opacity: 0;
transition: 0.5s;
transform: translateX(-50%) translateY(-50px);
}
ul li:hover .content {
visibility: visible;
opacity: 1;
transform: translateX(-50%) translateY(0px);
}
</style>
HTML
<body>
<ul>
<li>
<div class="content">
<h2>周一</h2>
<p>洗衣服</p>
</div>
</li>
<li>
<div class="content">
<h2>周二</h2>
<p>拖地</p>
</div>
</li>
<li>
<div class="content">
<h2>周三</h2>
<p>抹桌子</p>
</div>
</li>
</ul>
</body>