【发布时间】:2015-06-20 18:42:46
【问题描述】:
我目前正在开发一个侧面导航栏,该导航栏将由旧的汉堡包按钮启用。
/* * 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 元素上时,如何使文本和字体真棒图标都改变颜色
【问题讨论】:
标签: html css colors hover font-awesome