<div class="box">
<h2>CSS List Item Hover Effect</h2>
<ul>
<li><span>1</span> List Item One</li>
<li><span>2</span> List Item Two</li>
<li><span>3</span> List Item Three</li>
<li><span>4</span> List Item Four</li>
<li><span>5</span> List Item Five</li>
<li><span>6</span> List Item Six</li>
</ul>
</div>
* {
margin: 0;
padding: 0;
box-sizing: border-box;
font-family: sans-serif;
}
body {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
background: #f6f6f6;
}
.box {
width: 300px;
border-bottom: 20px solid #03a9f4;
border-bottom-left-radius: 10px;
border-bottom-right-radius: 10px;
}
.box h2 {
color: #fff;
background: #03a9f4;
padding: 10px 20px;
font-size: 20px;
font-weight: 700;
border-top-left-radius: 10px;
border-top-right-radius: 10px;
}
.box ul {
position: relative;
background: #fff;
}
.box ul:hover li {
opacity: 0.2;
}
.box ul li {
list-style: none;
padding: 10px;
width: 100%;
background: #fff;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.1);
transition: transform 0.5s;
}
.box ul li:hover {
transform: scale(1.1);
z-index: 5;
background: #25bcff;
box-shadow: 0 5px 25px rgba(0, 0, 0, 0.2);
color: #fff;
opacity: 1;
}
.box ul li span {
width: 20px;
height: 20px;
text-align: center;
line-height: 20px;
background: #25bcff;
color: #fff;
display: inline-block;
border-radius: 50%;
margin-right: 10px;
font-size: 12px;
font-weight: 600;
transform: translateY(-2px);
}
.box ul li:hover span {
background: #fff;
color: #25bcff;
}
This Pen doesn't use any external CSS resources.
This Pen doesn't use any external JavaScript resources.