css布局实现多彩跑道时间轴效果代码
代码语言:html
所属分类:布局界面
代码描述:css布局实现多彩跑道时间轴效果代码
下面为部分代码预览,完整代码请点击下载或在bfwstudio webide中打开
<!DOCTYPE html> <html lang="zh"> <head> <meta charset="UTF-8"> <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>css3跑道式时间轴设计效果</title> <link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.3.3.4.css"> <style type="text/css"> body, html { font-size: 100%; padding: 0; margin: 0; } /* Reset */ *, *:after, *:before { -webkit-box-sizing: border-box; -moz-box-sizing: border-box; box-sizing: border-box; } /* Clearfix hack by Nicolas Gallagher: http://nicolasgallagher.com/micro-clearfix-hack/ */ .clearfix:before, .clearfix:after { content: " "; display: table; } .clearfix:after { clear: both; } body { background: #494A5F; color: #D5D6E2; font-weight: 500; font-size: 1.05em; font-family: "Microsoft YaHei","Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif; } .main-timeline { font-family: 'Roboto', sans-serif; padding: 20px 0; position: relative; } .main-timeline:before, .main-timeline:after { content: ''; height: 40px; width: 40px; background-color: #e7e7e7; border-radius: 50%; border: 10px solid #303334; transform: translateX(-50%); position: absolute; left: 50%; top: -15px; z-index: 2; } .main-timeline:after { top: auto; bottom: 15px; } .main-timeline .timeline { padding: 35px 0; margin-top: -30px; position: relative; z-index: 1; } .main-timeline .timeline:before, .main-timeline .timeline:after { content: ''; height: 100%; width: 50%; border-radius: 100px 0 0 100px; border: 15px solid #46B2BC; border-right: none; position: absolute; left: 0; top: 0; z-index: -1; } .main-timeline .timeline:after { height: calc(100% - 30px); width: calc(50% - 12px); border-color: #65C7D0; left: 12px; top: 15px; } .main-timeline .timeline-content { display: inline-block; } .main-timeline .timeline-content:hover { text-decoration: none; } .main-timeline .timeline-year { color: #65C7D0; font-size: 50px; font-weight: 600; display: inline-block; transform: translateY(-50%); position: absolute; top: 50%; left: 10%; } .main-timeline .timeline-icon { color: #65C7D0; font-size: 80px; display: inline-block; transform: translateY(-50%); position: absolute; left: 34%; top: 50%; } .main-timeline .content { color: #909090; width: 50%; padding: 20px; display: inline-block; float: right; } .main-timeline .title { color: #65C7D0; font-size: 22px; font-weight: 600; text-transform: uppercase; letter-spacing: 1px; margin: 0 0 5px 0; } .main-timeline .description { font-size: 15px; letter-spacing: 1px; margin: 0; } .main-timeline .timeline:nth-child(even):before { left: auto; right: 0; border-radius: 0 100px 100px 0; border: 15px solid red; border-left: none; } .main-timeline .timeline:nth-child(even):after { left: auto; right: 12px; border: 15px solid green; border-left: none; border-radius: 0 100px 100px 0; } .main-timeline .timeline:nth-child(even) .content { float: left; } .main-timeline .timeline:nth-child(even) .timeline-year { left: auto; right: 10%; } .main-timeline .timeline:nth-child(even) .timeline-icon { left: auto; right: 32%; } .main-timeline .timeline:nth-child(5n+2):before { border-color: #EA3C14; } .main-timeline .timeline:nth-child(5n+2):after { border-color: #EF5720; } .main-timeline .timeline:nth-child(5n+2) .timeline-icon { color: #EA3C14; } .main-timeline .timeline:nth-child(5n+2) .timeline-year { color: #EA3C14; } .main-timeline .timeline:nth-child(5n+2) .title { color: #EA3C14; } .main-timeline .timeline:nth-child(5n+3):before { border-color: #8CC63E; } .main-timeline .timeline:nth-child(5n+3):after { border-color: #6CAF29; } .main-timeline .timeline:nth-child(5n+3) .timeline-icon { color: #8CC63E; } .main-timeline .timeline:nth-child(5n+3) .timeline-year { color: #8CC63E; } .main-timeline .timeline:nth-child(5n+3) .title { color: #8CC63E; } .main-timeline .timeline:nth-child(5n+4):before { border-color: #F99324; } .main-timeline .timeline:nth-child(5n+4):after { border-color: #FBB03B; } .main-timeline .timeline:nth-child(5n+4) .timeline-icon { color: #F99324; } .main-timeline .timeline:nth-child(5n+4) .timeline-year { color: #F99324; } .main-timeline .timeline:nth-child(5n+4) .title { color: #F99324; } .main-timeline .timeline:nth-child(5n+5):before { border-color: #0071BD; } .main-timeline .timeline:nth-child(5n+5):after { border-color: #0050A3; } .main-timeline .timeline:nth-child(5n+5) .timeline-icon { color: #0071BD; } .main-timeline .timeline:nth-child(5n+5) .timeline-year { color: #0071BD; } .main-timeline .timeline:nth-child(5n+5) .title { color: #0071BD; } @media screen and (max-width:1200px) { .main-timeline .timeline:after { border-radius: 88px 0 0 88px; } .main-timeline .timeline:nth-child(even):after { border-radius: 0 88px 88px 0; } } @media screen and (max-width:767px) { .main-timeline .timeline { margin-top: -19px; } .main-timeline .timeline:before { border-radius: 50px 0 0 50px; border-width: 10px; } .main-timeline .timeline:after { height: calc(100% - 18px); width: calc(50% - 9px); .........完整代码请登录后点击上方下载按钮下载查看
网友评论0