gpt4 book ai didi

html - 使 FA 在 :hover with
  • 上改变颜色
  • 转载 作者:太空宇宙 更新时间:2023-11-04 03:10:25 25 4
    gpt4 key购买 nike

    我目前在侧边导航栏的基础上工作,它将由旧的汉堡包按钮启用。

    /* * Navigation Menu
    * The Hambuger will open this
    *

    */

    .navigation-container {
    height: 100%;
    width: 240px;
    background: #FFFFFF;
    border-right: 2px solid #252525;
    position: fixed;
    top: 0;
    left: 0;
    }

    .navigation {
    width: 80%;
    padding: 0;
    margin: 0;
    margin-left: 10px;
    }

    .navigation ul {
    margin: 0;
    padding: 0;
    margin-top: 90px;
    margin-left: 20px;
    }

    .navigation ul li {
    /* Setting the area */
    list-style: none;
    margin: 0 auto;
    padding: 20px 0px;
    /* Typography changes */
    text-decoration: none;
    color: #DDDDDD;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 1.5px;
    /* Extra Styling */
    border-bottom: 1px solid #DDDDDD;
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease-in-out;
    }

    .navigation ul .fa {
    padding: 0;
    margin: 0;
    padding-right: 5px;
    font-size: 20px;
    color: #DDDDDD;
    }

    .navigation-container, .navigation li, > li {
    color: #252525;
    }

    .navigation ul li:hover {
    padding: 35px 0px;
    color: #252525;
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease-in-out;
    }
    <!DOCTYPE html>
    <html>

    <head>

    <meta charset="UTF-8">

    <title>Aaron Ward's Portfolio</title>

    <!-- Stylesheet links -->
    <!-- Font Awesome -->
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">

    <!-- Open Sans Typeface Import -->
    <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,800,600' rel='stylesheet' type='text/css'>

    <!-- Personal stylesheets -->
    <link rel="stylesheet" href="css/style.css">

    </head>

    <body>

    <!-- NAVIGATION START -->
    <div class="navigation-container">
    <div class="navigation">
    <ul>
    <a href="">
    <li>
    <i class="fa fa-home fa-fw"></i></span>
    HOME
    </li>
    </a>

    <a href="">
    <li>
    <i class="fa fa-connectdevelop fa-fw"></i>
    WORK
    </li>
    </a>

    <a href="">
    <li>
    <i class="fa fa-user fa-fw"></i>
    ABOUT
    </li>
    </a>

    <a href="">
    <li>
    <i class="fa fa-envelope fa-fw"></i>
    CONTACT
    </li>
    </a>
    </ul>
    </div>
    </div>

    </body>

    正如您将鼠标悬停在 [ul li] 元素上时所看到的,超赞字体图标没有改变颜色。

    我试过添加以下内容(结果无效):

    .navigation ul li:hover, .navigation ul .fa:hover {
    padding: 35px 0px;
    color: #252525;
    -webkit-transition: .25s ease-in-out;
    -moz-transition: .25s ease-in-out;
    -o-transition: .25s ease-in-out;
    transition: .25s ease-in-out;
    }

    .navigation ul .fa:hover {
    color: #252525;
    }

    但显然这行不通,因为我希望整个区域都影响两个元素(FA 和

  • 文本颜色。

    所以最终:将鼠标悬停在受人尊敬的 ul li 元素上时,如何使文本和 Font awesome 图标都改变颜色

  • 最佳答案

    您的标记有问题,<a>应该在<li>里面.和 <li>必须直属<ul> ,您可以一次将其全部修复。

    a:hover {
    color: red;
    }

    /* if the above code didn't work for you
    a:hover, a:hover .fa {
    color: green;
    }
    */

    /* if the above code didn't work for you
    a:hover, a:hover .fa::before {
    color: blue;
    }
    */
    <link rel="stylesheet" href="http://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css">
    <ul>
    <li>
    <a href="#">
    <i class="fa fa-home fa-fw"></i>
    HOME
    </a>
    </li>
    </ul>

    关于html - 使 FA 在 :hover with <li> 上改变颜色,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/29639482/

    25 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com