📜  带有下划线悬停动画的 CSS 菜单列表 - CSS 代码示例

📅  最后修改于: 2022-03-11 14:47:29.742000             🧑  作者: Mango

代码示例1
.nav-links ul li a{
    /* update color of link text to white, size to 13px and
     delete underline of link-text*/
    color: #fff;
    text-decoration: none;
    font-size: 13px;
}
.nav-links ul li::after{
    /* underline red as a after content it equal a div
    with background color,..*/
    content: '';
    width: 0;
    height: 2px;
    background: #f44336;
    display: block;
    margin: auto;
    transition: 0.5s;
}
.nav-links ul li:hover::after{
    /* ul li ::after when hover */
    width:100%;
}