- 此问题在此处已有答案**:
CSS transform doesn't work on inline elements(2个答案)
3天前关闭。
在元素上添加悬停效果无效.可能是因为它的父元素<li>
.我不知道
我试图应用悬停效果(translateY)的元素是在一个元素.但不工作,但如果我应用悬停(transnlateY).它的作品.有人能告诉我什么问题. element which is inside a element.but is not working but if i apply hover(trasnlateY) on . its works. can someone tell me whats the problem.
a {
cursor: pointer;
text-decoration: none;
font-family: 'Ubuntu', sans-serif;
font-size: 1.2rem;
font-weight: bold;
color: white;
transition: all 0.3s ease-in;
}
a:hover {
color: aquamarine;
transform: translateY(-10px)
}
<nav id="navbar">
<a id="nav-brand" href="">MrinB</a>
<div id="div-items">
<ul id="ul-items">
<li class="li-items"><a id="a" href=""> Home</a></li>
<li class="li-items"><a id="a" href="">Contact</a></li>
<li class="li-items"><a id="a" href="">About Me</a></li>
</ul>
</div>
</nav>
1条答案
按热度按时间0lvr5msh1#
在
a
标签上添加display-inline:block