我正在制作带有过渡效果的标题,但是有些地方不起作用。
我将ul设置为120px,li设置为60px,并且给li:hover添加了一个translateY(-60px)。这样当你悬停在li上时,它就会弹出来。
我想隐藏溢出的内容,直到你悬停在它上面。但是似乎不起作用。它只会悬停隐藏li的边框。
有人知道原因吗?
提前感谢您!
我将ul设置为120px,li设置为60px,并且给li:hover添加了一个translateY(-60px)。这样当你悬停在li上时,它就会弹出来。
我想隐藏溢出的内容,直到你悬停在它上面。但是似乎不起作用。它只会悬停隐藏li的边框。
有人知道原因吗?
提前感谢您!
<header>
<ul>
<li>
<a id="p1" href="#">Vibe</a>
<a id="p2" href="#">Vibe</a>
</li>
<li>
<a id="p1" href="#">Creations</a>
<a id="p2" href="#">Creations</a>
</li>
<li>
<a id="p1" href="#">Vision</a>
<a id="p2" href="#">Vision</a>
</li>
<li>
<a id="p1" href="#">Just tell us</a>
<a id="p2" href="#">Just tell us</a>
</li>
</ul>
</header>
这是CSS样式表:
header {
height: 60px;
width: 100%;
background-color: #34495e;
}
header ul {
margin-right: 20px;
float: right;
height: 60px;
overflow: hidden;
}
header ul li {
display: inline-block;
height: 120px;
padding-left: 40px;
padding-right: 40px;
overflow: hidden;
-webkit-transition: -webkit-transform 0.2s ease-in-out;
overflow: hidden;
border-left: 1px solid #2c3e50;
}
header ul li a {
text-decoration: none;
line-height: 60px;
font-size: 14px;
font-family: "lato", sans-serif;
font-weight: 700;
color: #e74c3c;
text-transform: uppercase;
-webkit-transform: rotate(10deg);
}
#p2 {
position: absolute;
text-align: center;
color: #c0392b;
line-height: 60px;
}
header ul li:hover {
-webkit-transform: translateY(-60px);
}