css 如何删除Font Awesome图标下面的行?

qmelpv7a  于 2023-05-02  发布在  其他
关注(0)|答案(3)|浏览(162)

我把一个图标车从字体真棒在我的导航栏。问题是,当我用鼠标过去时,这一行出现在购物车图标的左下方。我尝试了很多方法,但我找不到删除这行的方法:

<!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;
}
jdgnovmf

jdgnovmf1#

只需添加这个CSS来改变悬停状态:

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

sulc1iza2#

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

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

polkgigr3#

我也有同样的问题。唯一的方法我能够采取线远离底部的图标是通过改变我的立场,以绝对。
我用的是font-awesome版本6。4.0.

相关问题