【发布时间】:2016-12-06 22:47:09
【问题描述】:
我在这里通过将锚标记的宽度设置为 100% 来寻找解决问题的方法,但似乎没有任何效果。
想要的效果是让整个 li 成为一个锚标签,以便在 li 悬停时锚的颜色会发生变化,并且整个 li 是可点击的
.totem-container {
background-color: #ffffff;
width: 200px;
color: #222222;
padding-top: 200px;
}
.totem-list {
width: 200px;
}
.totem-list li {
width: 200px;
height: 35px;
list-style: none;
transition: all .1s ease-in-out;
-webkit-box-shadow: 0 4px 10px -6px #222;
-moz-box-shadow: 0 4px 10px -6px #222;
box-shadow: 0 4px 10px -6px #222;
}
.totem-list li:hover {
transform: scale(1.1);
}
.totem-list a {
color: #222222;
list-style: none;
text-decoration: none;
font-size: 16px;
line-height: 35px;
width: 100%;
height: 100%;
}
.totem-list a:hover {
color: #78A025; !important
}
.totem-list i {
font-size: 25px;
margin-top: 5px;
width: 35px;
margin-left: 5px;
color: #4f4f4f;
}
.totem-list i.social {
font-size: 35px;
text-align: center;
margin: 1px;
color: #007DC3;
transition: all .1s ease-in-out;
}
.totem-list i.social:hover {
transform: scale(1.1);
color: #78A025;
}
<head>
</head>
<body>
<div class="totem-container center-block pull-right">
<ul class="totem-list">
<a href="#"><i class="fa fa-facebook-square social"></i></a>
<a href="#"><i class="fa fa-twitter-square social"></i></a>
<a href="#"><i class="fa fa-google-plus-square social"></i></a>
<a href="#"><i class="fa fa-youtube-square social"></i></a>
<li>
<i class="fa fa-user"></i>
<a href="#">Sign Up</a>
</li>
<li>
<i class="fa fa-phone"></i>
<a href="#">Contact Sales</a>
</li>
<li>
<i class="fa fa-sign-in"></i>
<a href="#">Log In</a>
</li>
</ul>
</div>
</body
为了实现这一目标,我需要进行哪些更改?
【问题讨论】:
-
您的 HTML 无效。
<a>不能是<ul>的子代
标签: css hover html-lists anchor