CSS hover box

transition 踩坑指南, display: none; 作为初始状态,不会产生动画效果,必须设置 height: 0; 或 width: 0; 来实现隐藏!

transition


* {
box-sizing: border-box;
margin: 0;
padding: 0;
} body {
position: relative;
} ul {
display: flex;
flex-flow: row nowrap;
justify-content: space-between;
align-items: center;
width: 50vw;
margin: 0 auto;
background: #fff;
border: 1px solid red;
padding: 10px;
}
ul>li {
list-style: none;
width: 100px;
height: 30px;
background: #ccc;
color: #0f0;
text-align: center;
/* text-decoration: underline; */
} a{
text-decoration: none;
} .link {
color: #f0f;
} .link:hover{
color: #0f0;
} .link + .hover-box,
.hover-box {
position: fixed;
display: block;
/* display: none; */
/* visibility: hidden; */
height: 0;
width: calc(100vw);
background: #000;
color: #fff;
top: 80px;
left: 0;
right: 0;
/* margin-top: 100px; */
overflow: hidden;
margin: 0;
padding: 0;
// transition: height 2s .5s ease-in-out;
transition: height 2s .5s ease-out;
}
/* .hover-box > p {
height: 0;
} */ .link:hover + .hover-box,
.hover-box:hover {
transition: height 2s .5s ease-in;
height: 200px;
// animation: hover-animation 2s .5s ease-in-out;
// padding: 30px;
// transition:
// height 2s .5s ease-in-out,
// padding-top 2s .5s ease-in-out,
// padding-bottom 2s .5s ease-in-out;
} /* .hover-box:hover > p {
height: auto;
} */ /* .link:hover + .hover-box,
.hover-box:hover {
width: calc(100vw);
height: 200px;
background: #000;
transition: height 1s .5s ease-in-out;
color: #fff;
padding: 30px;
} */ /* animation: 2s linear hover-animation 1s; */
/* animation-name, animation-duration, animation-timing-function, animation-delay, animation-iteration-count, animation-direction, animation-fill-mode, animation-play-state. */ @keyframes hover-animation {
0% {
height: 0px;
}
25% {
height: 25px;
}
50% {
height: 50px;
}
75% {
height: 75px;
}
100% {
height: 100px;
}
}

demo

See the Pen hover box by xgqfrms
(@xgqfrms) on CodePen.

animate.css

https://animate.style/

https://github.com/animate-css/animate.css

refs

https://codepen.io/xgqfrms/pen/NWRaXoN

https://codepen.io/xgqfrms/pen/LYRzqZq



xgqfrms 2012-2020

www.cnblogs.com 发布文章使用:只允许注册用户才可以访问!


CSS hover box的更多相关文章

  1. css:hover状态改变另一个元素样式的使用

    效果演示 css:hover状态改变另一个元素样式的使用 .box { width: 150px; height: 150px; background-color: #069; line-height ...

  2. 【笔记】css hover 伪类控制其他元素

    最近在模仿一个网站的项目 当中有一个效果需要利用到hover效果因为不太想写jq脚本所以百度了一下css hover的运用发现原来hover也可以控制其他元素的变化的 但是这有一个要求 就是添加hov ...

  3. CSS active选择器与CSS hover选择器

    <!DOCTYPE HTML> <html lang="en-US"> <head> <meta charset="UTF-8& ...

  4. CSS hover

    CSS hover hover 鼠标移动到当前标签上时,以下css属性才能生效 <!DOCTYPE html> <html lang="en"> <h ...

  5. 10个CSS+HOVER 的创意按钮

    CSS hover 样式很简单,但是想创造出有意思.实用.有创意性的特效是很考验设计师的创意能力,所以设计达人每隔一段时间都会分享一些与鼠标点击.悬停的相关特效,以便大家获得更好的创造灵感. 今天我们 ...

  6. css hover伪类选择器与JQuery hover()方法

    css hover伪类选择器 它属于anchor伪类 在支持 CSS 的浏览器中,<a>标签链接的不同状态都可以以不同的方式显示,常常用来改链接的颜色效果 实例 a:link {color ...

  7. css 3d box 实现的一些注意事项

    Test1.html <!DOCTYPE html> <html lang="en"> <head> <meta charset=&quo ...

  8. css hover 动画 transition:background-color 0.2s,color 0.2s; 外层套内层,正常是 里外层 鼠标上来 外层有hover,如果就想到里层hover触发外层hover,要用外层position 定义绝对定位,内层的hover跳出外层的div,这样视觉上就是两个单独的div,进行内外层联动。

    css hover 动画 transition:background-color 0.2s,color 0.2s; 外层套内层,正常是 里外层 鼠标上来 外层有hover,如果就想到里层hover触发 ...

  9. css hover对其包含的元素进行样式设置

    <ul class="icon-down-single-arr-li"> <li> <a href="javascript:void(0)& ...

随机推荐

  1. 如果using语句中出现异常,资源会被释放掉吗?

    <CLR Via C#>第三版 P489 在using内部抛出了异常,被using的对象还是会被释放掉. Using编译时会自动生成Try Finally代码块. 同样Using只能用于实 ...

  2. 【UNIAPP】接入导航系统完整版

    // 查询附近/搜索关键词 <template> <view> <!--地图容器--> <map id="myMap" :markers= ...

  3. 新型赌博黑产攻击肆虐网吧: LOL博彩引流+棋牌盗号

    https://mp.weixin.qq.com/s/BxnovV6jKqPkYfHEzjd_FA 新型赌博黑产攻击肆虐网吧: LOL博彩引流+棋牌盗号 看雪学院 2019-04-21

  4. linux系统层面调优

    linux系统层面调优和常见的面试题 - 云+社区 - 腾讯云 https://cloud.tencent.com/developer/article/1664287

  5. Salt (cryptography)

    Salt (cryptography) Here is an incomplete example of a salt value for storing passwords. This first ...

  6. loj10009钓鱼___vector的调试

    题目描述 在一条水平路边,有 n 个钓鱼湖,从左到右编号为1,2,...,n .佳佳有 h 个小时的空余时间,他希望利用这个时间钓到更多的鱼.他从1  出发,向右走,有选择的在一些湖边停留一定的时间( ...

  7. MySql(二)索引的设计与使用

    MySql(二)索引的设计与使用 一.索引概述 二.设计索引的原则 三.BTREE索引与HASH索引 一.索引概述 所有Mysql列类型都可以被索引,对相关列使用索引时提高select操作性能的最佳途 ...

  8. Mysql容器启动失败-解决方案

    在看问题之前首先熟悉几个命令 相关命令 1.docker attach 连接到正在运行中的容器: 命令:docker attach --sig-proxy=false mynginx 2.docker ...

  9. 数字转金额格式* 999999.99 TO 999,999.99

    /** * 数字转金额格式 * 999999.99 TO 999,999.99 * @param d * @return */ public static String doubleToStr(dou ...

  10. Redis挖矿原理及防范

    笔者也曾经被挖矿病毒侵袭过,灰常难受,但是其实你只要了解入侵的手段就非常好防范了,今天我们就演示一下如果通过Redis进行提权获取远程服务器的Root用户. 1.首先我们需要一些先决条件 条件一:你首 ...