gpt4 book ai didi

html - 悬停时倾斜平行四边形

转载 作者:太空宇宙 更新时间:2023-11-04 15:50:01 26 4
gpt4 key购买 nike

这是我的导航栏...当我将鼠标悬停在链接上时,它应该变成普通文本,但它显示的是对 Angular 线文本...

.navbar-menu2 li a:hover{
color: black;
width: 100%;
height: auto;
background-color: red;
transform: skewX(-30deg);
transform-origin: top;
/* Zentriert den Inhalt */
display: flex;
justify-content: center;
align-items: center;
text-transform: uppercase;
font-family: 'Lato', sans-serif;
}

.navbar-menu2 li a span:hover{
transform: skewX(30deg);
}
    <nav class="navbar navbar-expand-md bg-dark p-0">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarNav1">
<span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarNav1">
<ul class="navbar-nav navbar-menu2 text-white">
<li class="nav-item">
<a href="#" class="nav-link navbar-second diagonal"><span>Home</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Classes</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Trainers</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Pricing</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Gallery</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Blog</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Contact</span></a>
</li>
</ul>
</div>
</div>
</nav>

当我们将鼠标悬停在文本上时它工作正常。即我的 span 标签。我想在 li 标签中使用相同的标签:当我们将鼠标悬停在它上面时得到普通文本。 提前致谢!

最佳答案

您需要将反向变换 (transform: skewX(30deg);) 放在

.navbar-menu2 li a:hover span

代替

.navbar-menu2 li a span:hover 

因为当相关的 a 悬停时,span 并不总是悬停:

.navbar-menu2 li a:hover{
color: black;
width: 100%;
height: auto;
background-color: red;
transform: skewX(-30deg);
transform-origin: top;
/* Zentriert den Inhalt */
display: flex;
justify-content: center;
align-items: center;
text-transform: uppercase;
font-family: 'Lato', sans-serif;
}

.navbar-menu2 li a:hover span{
transform: skewX(30deg);
}
<nav class="navbar navbar-expand-md bg-dark p-0">
<div class="container">
<button class="navbar-toggler" data-toggle="collapse" data-target="#navbarNav1">
<span class="navbar-toggler-icon"></span></button>
<div class="collapse navbar-collapse" id="navbarNav1">
<ul class="navbar-nav navbar-menu2 text-white">
<li class="nav-item">
<a href="#" class="nav-link navbar-second diagonal"><span>Home</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Classes</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Trainers</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Pricing</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Gallery</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Blog</span></a>
</li>
<li class="nav-item">
<a href="#" class="nav-link navbar-second"><span>Contact</span></a>
</li>
</ul>
</div>
</div>
</nav>

关于html - 悬停时倾斜平行四边形,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51305638/

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