List Hover Effect
HTML CODE:-
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title></title> </head> <body> <div class="container"> <h3>Top Trending Courses</h3> <ul> <li><span>Data structure Using Java</span></li> <li><span>Flutter</span></li> <li><span>Web Designing</span></li> <li><span>Advanced Python</span></li> <li><span>Programming C++</span></li> </ul> </div> </body> </html> |
CSS CODE:-
*{ padding: 0px; margin: 0px; box-sizing: border-box; } body{ display: flex; align-items: center; justify-content: center; min-height: 100vh; background: black; } .container{ position: relative; } .container h3{ position: relative; color: white; } .container ul li{ position: relative; color: #acadb0; list-style-type: none; margin: 12px 0; cursor: pointer; transition: 0.5s; border-left: 2px solid #cedbf2; } .container li:hover{ left: 10px; } .container ul li::before{ content: ""; position: absolute; width: 100%; height: 100%; background: #cedbf2; transform: scaleX(0); transform-origin: left; transition: 0.5s; } .container ul li:hover::before{ transform: scaleX(1); } .container ul li span{ position: relative; padding: 10px; display: inline-block; z-index: 1; transition: 0.5s; } .container ul li:hover span{ color: black; } |