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. K8s secret解密

    root@ubuntu:~# kubectl get secret rbd-db -n rbd-system -o yaml apiVersion: v1 data: mysql-password: ...

  2. 十九、更改LCD显示屏

    一.裸机修改 之前测试用的屏幕是480*272的分辨率,现在要换成800*480的屏,因此要对软件代码进行修改. 对于裸机驱动而言,主要有两个点需要注意,一个是屏幕分辨率变了,因此初始化的时候与屏幕分 ...

  3. IDEA_2019.1版本中Protobuf的使用

    一.Protobuf是什么 Protobuf 是 Google 发布的开源项目,全称 Google Protocol(/'prəʊtəkɒl/,协议,草案) Buffers,是一种轻便高效的结构化数据 ...

  4. 小步前进之WCF简介

    WCF 前言 什么是WCF? 契约 合约 前言 在 .NET Framework2.0 以及前版本中,微软发展了 Web Service..NET Remoting 等通信支持. 如果要进行通信,对于 ...

  5. <script>元素

    简介 向HTML页面中插入JavaScript的主要方法,就是使用'<'script'>'元素. 标签的位置 现代Web应用程序一般都把全部的JavaScript饮用放在'<'bod ...

  6. ThinkPHP 5.0.24 反序列化RCE (Windows下EXP)

    直接上exp吧,Windows下. <?php namespace think\process\pipes; class Windows { private $files = []; publi ...

  7. Centos7服务器安装Docker及Docker镜像加速,Docker删除

    Centos7服务器安装Docker及Docker镜像加速,Docker删除 1.Centos7服务器安装Docker 1.1 root账户登录,查看内核版本如下 1.1.1 卸载服务器旧版本Dock ...

  8. Dockerfile,Dockerfile 参考文档

    Dockerfile,Dockerfile 参考文档 1.Dockerfile 1.1Usage 1.2Format 1.3Parser directives 1.4escape 1.5Environ ...

  9. sublime text 2应用

    http://www.sublimetext.com/2 可以下一个 a portable version  我自己的是win版和linux版都有 1.添加注释 先选择要注释的内容,然后按 ctrl ...

  10. PHP版本Non Thread Safe和Thread Safe如何选择?区别是什么?

    PHP版本分为Non Thread Safe和Thread Safe,Non Thread Safe是指非线程安全,Thread Safe是指线程安全,区别是什么?如何选择? Non Thread S ...