css实现悬浮图片背景自伸缩大事记时间线悬浮显示文字效果代码
代码语言:html
所属分类:悬停
代码描述:css实现悬浮图片背景自伸缩大事记时间线悬浮显示文字效果代码
代码标签: 图片 背景 自 伸缩 大事记 时间 线 悬浮 显示 文字 效果
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/normalize.min.css"> <link href="https://fonts.googleapis.com/css?family=Pathway+Gothic+One|Source+Sans+Pro:400" rel="stylesheet"> <style> body { font-family: 'Source Sans Pro',Helvetica Neue,Helvetica,Arial,sans-serif; font-size: 16px; line-height: 1.75; } #timeline { display: -webkit-box; display: flex; background-color: #031625; } #timeline:hover .tl-item { width: 23.3333%; } .tl-item { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); position: relative; width: 25%; height: 100vh; min-height: 600px; color: #fff; overflow: hidden; -webkit-transition: width 0.5s ease; transition: width 0.5s ease; } .tl-item:before, .tl-item:after { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); content: ''; position: absolute; left: 0; top: 0; width: 100%; height: 100%; } .tl-item:after { background: rgba(3, 22, 37, 0.85); opacity: 1; -webkit-transition: opacity 0.5s ease; transition: opacity 0.5s ease; } .tl-item:before { background: -webkit-gradient(linear, left top, left bottom, from(rgba(0, 0, 0, 0)), color-stop(75%, black)); background: linear-gradient(tobottom, rgba(0, 0, 0, 0) 0%, black 75%); z-index: 1; opacity: 0; -webkit-transform: translate3d(0, 0, 0) translateY(50%); transform: translate3d(0, 0, 0) translateY(50%); -webkit-transition: opacity 0.5s ease, -webkit-transform 0.5s ease; transition: opacity 0.5s ease, -webkit-transform 0.5s ease; transition: opacity 0.5s ease, transform 0.5s ease; transition: opacity 0.5s ease, transform 0.5s ease, -webkit-transform 0.5s ease; } .tl-item:hover { width: 30% !important; } .tl-item:hover:after { opacity: 0; } .tl-item:hover:before { opacity: 1; -webkit-transform: translate3d(0, 0, 0) translateY(0); transform: translate3d(0, 0, 0) translateY(0); -webkit-transition: opacity 1s ease, -webkit-transform 1s ease 0.25s; transition: opacity 1s ease, -webkit-transform 1s ease 0.25s; transition: opacity 1s ease, transform 1s ease 0.25s; transition: opacity 1s ease, transform 1s ease 0.25s, -webkit-transform 1s ease 0.25s; } .tl-item:hover .tl-content { opacity: 1; -webkit-transform: translateY(0); transform: translateY(0); -webkit-transition: all 0.75s ease 0.5s; transition: all 0.75s ease 0.5s; } .tl-item:hover .tl-bg { -webkit-filter: grayscale(0); filter: grayscale(0); } .tl-content { -webkit-transform: translate3d(0, 0, 0) translateY(25px); transform: translate3d(0, 0, 0) translateY(25px); position: relative; z-index: 1; text-align: center; margin: 0 1.618em; top: 55%; opacity: 0; } .tl-content h1 { font-family: 'Pathway Gothic One',Helvetica Neue,Helvetica,Arial,sans-serif; text-transform: uppercase; color: #1779cf; font-size: 1.44rem; font-weight: normal; } .tl-year { position: absolute; top: 50%; left: 50%; -webkit-transform: translateX(-50%) translateY(-50%); transform: translateX(-50%) translateY(-50%); z-index: 1; border-top: 1px solid #fff; border-bottom: 1px solid #fff; } .tl-year p { font-family: 'Pathway Gothic One',Helvetica Neue,Helvetica,Arial,sans-serif; font-size: 1.728rem; line-height: 0; } .tl-bg { -webkit-transform: translate3d(0, 0, 0); transform: translate3d(0, 0, 0); position: absolute; wid.........完整代码请登录后点击上方下载按钮下载查看
网友评论0