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">

<link type="text/css" rel="stylesheet" href="//repo.bfw.wiki/bfwrepo/css/bootstrap.3.3.4.css">
<style>
    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: #bdd9f5;
	color: #D5D6E2;
	font-weight: 500;
	font-size: 1.05em;
	font-family: "Microsoft YaHei","Segoe UI", "Lucida Grande", Helvetica, Arial,sans-serif;
}
</style>
	
	<style type="text/css">
		.demo{padding: 2em 0;}
		.main-timeline{
		    overflow: hidden;
		    position: relative;
		}
		.main-timeline:before{
		    content: "";
		    width: 7px;
		    height: 100%;
		    background: #909090;
		    position: absolute;
		    top: 0;
		    left: 50%;
		    transform: translateX(-50%);
		}
		.main-timeline .timeline{
		    width: 50%;
		    padding-left: 50px;
		    float: right;
		    position: relative;
		}
		.main-timeline .timeline:before{
		    content: "";
		    width: 30px;
		    height: 30px;
		    border-radius: 50%;
		    background: #909090;
		    border: 7px solid #fff;
		    position: absolute;
		    top: 50%;
		    left: -15px;
		    transform: translateY(-50%);
		}
		.main-timeline .timeline:after{
		    content: "";
		    display: block;
		    border-right: 30px solid #ee4423;
		    border-top: 20px solid transparent;
		    border-bottom: 20px solid transparent;
		    position: absolute;
		    top: 50%;
		    left: 24px;
		    transform: translateY(-50%);
		}
		.main-timeline .timeline-content{
		    display: block;
		    padding: 25px;
		    border-radius: 100px;
		    background: #ee4423;
		    position: relative;
		}
		.main-timeline .timeline-content:before,
		.main-timeline .timeline-content:after{
		    content: "";
		    display: block;
		    width: 100%;
		    clear: both;
		}
		.main-timeline .timeline-content:hover{ text-decoration: none; }
		.main-timeline .inner-content{
		    width: 70%;
		    float: right;
		    padding: 15px 20px 15px 15px;
		    background: #fff;
		    border-radius: 0 100px 100px 0;
		    color: #ee4423;
		}
		.main-timeline .year{
		    display: inline-block;
		    font-size: 50px;
		    font-weight: 600;
		    color: #fff;
		    position: absolute;
		    top: 50%;
		    left: 7%;
		    transform: translateY(-50%);
		}
		.main-timeline .title{
		    font-size: 24px;
		    font-weight: 600;
		    text-transform: uppercase;
		    margin: 0 0 5px 0;
		}
		.main-timeline .description{
		    font-size: 14px;
		    margin: 0 0 5px 0;
		}
		.main-timeline .timeline:nth-child(2n){ padding: 0 50px 0 0; }
		.main-timeline .timeline:nth-child(2n):before,
		.main-timeline .timeline:nth-child(2n) .year{
		    left: auto;
		    right: -15px;
		}
		.main-timeline .timeline:nth-child(2n) .year{ right: 7%; }
		.main-timeline .timeline:nth-child(2n):after{
		    border-right: none;
		    border-left: 30px solid #ee4423;
		    left: auto;
		    right: 24px;
		}
		.main-timeline .timeline:nth-child(2n) .inner-content{
		    float: none;
		    border-radius: 100px 0 0 100px;
		    text-align: right;
		}
		.main-timeline .timeline:nth-child(2){ margin-top: 130px; }
		.main-timeline .timeline:nth-child(odd){ margin: -130px 0 0 0; }
		.main-timeline .timeline:nth-child(even){ margin-bottom: 80px; }
		.main-timeline .timeline:first-child,
		.main-timeline .timeline:last-child:nth-child(even){ margin: 0; }
		.main-timeline .timeline:nth-child(2n) .timeline-content{ background: #f68829; }
		.main-timeline .timeline:nth-child(2n),
		.main-timeline .timeline:nth-child(2n) .inner-content{ color: #f68829; }
		.main-timeline .timeline:nth-child(2n):after{ border-left-color: #f68829; }
		.main-timeline .timeline:nth-child(3n) .timeline-content{ background: #2991d0; }
		.main-timeline .timeline:nth-child(3n),
		.main-timeline .timeline:nth-child(3n) .inner-content{ color: #2991d0; }
		.main-timeline .timeline:nth-child(3n):after{ border-right-color: #2991d0; }
		.main-timeline .timeline:nth-child(4n) .timeline-content{ background: #9361aa; }
		.main-timeline .timeline:nth-child(4n),
		.main-timeline .timeline:nth-child(4n) .inner-content{ color: #9361aa; }
		.main-timeline .timeline:nth-child(4n):after{ border-left-color: #9361aa; }
		.main-timeline .timeline:nth-child(5n) .timeline-content{ background: #a7be26; }
		.main-timeline .timeline:nth-child(5n),
		.main-timeline .timeline:nth-child(5n) .inner-content{ color: #a7be26; }
		.main-timeline .timeline:nth-child(5n):after{ border-right-color: #a7be26; }
		@media only screen and (max-width: 1200px){
		    .main-timeline .inner-content{ width: 80%; }
		    .main-timeline .year{
		        font-size: 45px;
		        left: 10px;
		        transform: translateY(-50%) rotate(-90deg);
		 .........完整代码请登录后点击上方下载按钮下载查看

网友评论0