首页 > 解决方案 > 如何在 Font Awesome 图标中删除下面的行?

问题描述

我在导航栏中放置了一个来自 Font Awesome 的图标购物车。问题是当我用鼠标移动时,这条线出现在购物车图标的左下方。我尝试了很多东西,但找不到删除此行的方法:

在此处输入图像描述

<!DOCTYPE html>

<html>
    <head>
        <link rel="stylesheet" type="text/css" href="main.css">

        <title>Σκοτεινή Πλευρά</title>
        <meta charset="UTF-8">
        <meta name="viewport" content="width=device-width, initial-scale=1.0">

        <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
        <link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.4.1/css/all.css">

    </head>

    <body>
        <nav>
            <div class="row justify-content-center">
                <div class="Basket">
                    <a href="#">
                        <i class="fa fa-shopping-cart" aria-hidden="true"></i>
                        <span class="Basket_Number">2</span>
                    </a>
                </div>
            </div>
        </nav>
    </body>
</html>
.Basket {
    display: inline-block;
    text-align: center;
    margin-right: 11px;
    margin-bottom: -6px;
}

.Basket a {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: relative;
    margin-top: 100px;
    font-size: 30px;
    width: 40px;
    height: 40px;
    color: #332f25;
    transition: color 0.3s ease;
    text-decoration: none;
}

.Basket_Number {
    display: flex;
    flex-direction: column;
    justify-content: center;
    position: absolute;
    top: -15px;
    left: 35px;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fe4c50;
    font-size: 12px;
    color: white;
}

标签: htmlcssbootstrap-4font-awesome

解决方案


悬停时使用 :hover 选择器去掉下划线

.Basket a:hover {
    text-decoration: none;
}

推荐阅读