CSS3實現(xiàn)時間軸特效

最近打開電腦就能看到極客學(xué)院什么新用戶vip免費一個月,就進去看看咯,這里就不說它的課程怎么滴了,里面實戰(zhàn)路徑圖頁面看到了這個效果:
有點像時間軸的趕腳,而且每一塊鼠標(biāo)懸浮上去也有下拉效果展開介紹截圖信息,就感覺效果還不錯。但感覺這種效果貌似對于動態(tài)添加不是很靈活,因為高度不像寬度可以靈活的自適應(yīng),故添加得自己一個一個設(shè)置。所以很多都是做成展示效果。
當(dāng)然啦,自己也基于它的這個想法搞了一點簡單點的類似效果,主要還是整個布局效果,具體每一塊內(nèi)容就不仿造了,而且我自己也加了一下開場動畫,讓它更好玩一些…
先來看看效果吧:
大概效果就是這樣啦,下來廢話不說,還是直接進入主題:
HTML結(jié)構(gòu):
<div class="timezone"> <div class="time"> <h2>2015-07-02</h2> <div> <p>暴走大事件第一季</p> <ul> </ul> </div> </div> <div class="timeLeft" style="top: 100px;"> <h2>2015-07-02</h2> <div> <p>暴走大事件第二季</p> <ul> </ul> </div> </div>
這里簡化了一下HTML結(jié)構(gòu),.time類表示在右邊,.timeLeft表示在左邊,然后加點上外邊距就可以了,每一塊里面的內(nèi)容我就刪減掉了。
CSS樣式代碼如下:
body{ background: #333; } h1{ text-align: center; color:#fff; } .timezone{ width:6px; height: 350px; background: lightblue; margin: 0 auto; margin-top:50px; border-radius: 3px; position: relative; -webkit-animation: heightSlide 2s linear; } @-webkit-keyframes heightSlide{ 0%{ height: 0; } 100%{ height: 350px; } } .timezone:after{ content: '未完待續(xù)...'; width: 100px; color:#fff; position: absolute; margin-left: -35px; bottom: -30px; -webkit-animation: showIn 4s ease; } .timezone .time,.timezone .timeLeft{ position: absolute; margin-left: -10px; margin-top:-10px; width:20px; height:20px; border-radius: 50%; border:4px solid rgba(255,255,255,0.5); background: lightblue; -webkit-transition: all 0.5s; -webkit-animation: showIn ease; } .timezone .time:nth-child(1){ -webkit-animation-duration:1s; } .timezone .timeLeft:nth-child(2){ -webkit-animation-duration:1.5s; } .timezone .time:nth-child(3){ -webkit-animation-duration:2s; } .timezone .timeLeft:nth-child(4){ -webkit-animation-duration:2.5s; } @-webkit-keyframes showIn{ 0%,70%{ opacity: 0; } 100%{ opacity: 1; } } .timezone .time h2,.timezone .timeLeft h2{ position: absolute; margin-left: -120px; margin-top: 3px; color:#eee; font-size: 14px; cursor:pointer; -webkit-animation: showIn 3s ease; } .timezone .timeLeft h2{ margin-left: 60px; width: 100px; } .timezone .time:hover,.timezone .timeLeft:hover{ border:4px solid lightblue; background: lemonchiffon; box-shadow: 0 0 2px 2px rgba(255,255,255,0.4); } .timezone .time div,.timezone .timeLeft div{ position: absolute; top:50%; margin-top: -25px; left:50px; width: 300px; height: 50px; background: lightblue; border:3px solid #eee; border-radius: 10px; z-index: 2; overflow: hidden; cursor:pointer; -webkit-animation: showIn 3s ease; -webkit-transition: all 0.5s; } .timezone .timeLeft div{ left:-337px; } .timezone .time div:hover,.timezone .timeLeft div:hover{ height: 170px; } .timezone .time div p,.timezone .timeLeft div p{ color: #fff; font-weight: bold; text-align: center; } .timezone .time:before,.timezone .timeLeft:before{ content: ''; position: absolute; top:0px; left: 32px; width: 0px; height: 0px; border:10px solid transparent; border-right:10px solid #eee; z-index:-1; -webkit-animation: showIn 3s ease; } .timezone .timeLeft:before{ left:-33px; border:10px solid transparent; border-left:10px solid #eee; } .timezone .time div ul,.timezone .timeLeft div ul{ list-style: none; width:300px; padding:5px 0 0; border-top:2px solid #eee; color:#fff; text-align: center; } .timezone .time div li,.timezone .timeLeft div li{ display: inline-block; height: 25px; line-height: 25px; }
此CSS樣式代碼僅供參考,實用性不是很強,而且同樣沒有怎么整理過,主要還是理解一下動畫效果還有整體布局吧。祝好!
原文鏈接:https://www.cnblogs.com/jr1993/p/4779678.html
以上就是CSS3實現(xiàn)時間軸特效的詳細內(nèi)容,更多關(guān)于CSS3 時間軸特效的資料請關(guān)注腳本之家其它相關(guān)文章!
相關(guān)文章
- 純CSS3實現(xiàn)蛇形時間軸特效代碼是一款簡潔、美觀的時間軸特效,代碼簡單,需要的朋友快來下載吧2020-09-01
- 這是一款實現(xiàn)css3跑道式時間軸設(shè)計效果,以彎曲的跑道作為時間軸的路線,以不同的顏色來區(qū)分時間點,采用響應(yīng)式設(shè)計,簡單炫酷2018-09-30
CSS3實現(xiàn)的響應(yīng)式彩色垂直時間軸特效源碼
CSS3彩色垂直時間軸特效是一段實現(xiàn)了創(chuàng)意響應(yīng)式時間軸樣式布局效果的代碼,本段代碼適應(yīng)于大部分網(wǎng)頁使用,歡迎有興趣的朋友們前來了解下2018-03-28- 這是一個炫酷css3垂直時間軸特效,通過偽元素來制作炫酷的半圓形,所有半圓形連接為一條曲線路徑,組成時間軸的線路,簡單炫酷,推薦下載2018-02-05
CSS3實現(xiàn)的網(wǎng)頁創(chuàng)意河流時間軸特效源碼
網(wǎng)頁創(chuàng)意河流時間軸特效是一段基于css3繪制流動河流,鼠標(biāo)懸停日期顯示內(nèi)容詳情的效果代碼,歡迎有興趣的朋友們前來下載使用2017-12-25純css3實現(xiàn)工單回復(fù)流程垂直時間軸特效源碼
純css3實現(xiàn)工單回復(fù)流程垂直時間軸特效源碼是手機端流程時間軸樣式代碼。本段代碼可以在各個網(wǎng)頁使用,有需要的朋友可以直接下載使用2017-12-18- 這是一款基于css3實現(xiàn)的垂直時間軸樣式效果源碼。采用bootstrap框架實現(xiàn)的時間軸顯示效果。用戶可靈活設(shè)置時間軸對話框上顯示的顏色及內(nèi)容2017-04-27
純CSS3 Bootstrap炫酷響應(yīng)式垂直時間軸特效源碼
基于Bootstrap的炫酷純CSS3響應(yīng)式垂直時間軸特效代碼,查詢來在不同的斷點下,對時間點時間面板進行排列2017-02-24- 這篇文章主要為大家詳細介紹了CSS3實現(xiàn)時間軸效果,具有一定的參考價值,感興趣的小伙伴們可以參考一下2016-07-11
- 是一段實現(xiàn)了扁平垂直效果的時間軸代碼,本段代碼適應(yīng)于所有網(wǎng)頁使用,有興趣的朋友們可以前來下載使用2015-08-27