[英]Javascript navigation hover effect
Does anyone know how to implement the navigation hover effect displayed on this web page into my HTML/CSS document? 有谁知道如何在我的HTML / CSS文档中实现此网页上显示的导航悬浮效果? The aforementioned page is using a WordPress theme, but I would like to add that green effect to my generic web page and be able to change the color as well. 前面提到的页面使用的是WordPress主题,但是我想将这种绿色效果添加到我的通用网页中,并且还可以更改颜色。
PS I have never used Javascript before. PS我以前从未使用过Javascript。 (Be nice.) (对人好点。)
Try This: 尝试这个:
ul li{
list-style:none;
}
ul li a{
transition:all 0.2s ease-out;
padding:5px;
border-radius:5px
}
ul li a:hover{
background-color:#&dcc0e;
}
<ul>
<li>
<a>Hello</a>
</li>
</ul>
This does not need any js. 这不需要任何js。 You can create the effect using css transition like this. 您可以像这样使用css过渡来创建效果。
div{ width: auto; float: left; } a{ color: red; text-decoration: none; padding: 5px 20px; float: left; position: relative; } a:hover{ color:#FFF; } a:after{ content: ''; background: red; position: absolute; top: 50%; right: 5%; bottom: 50%; left: 5%; border-radius: 3px; transition: all .1s; z-index: -1; } a:hover:after{ top: 0; right: 0; bottom: 0; left: 0; }
<div><a href="javaScript:void(0);">menu</a></div>
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.