其他代码

垂直时间轴特效CSS3代码

阿里云


使用方法
在 HTML 文件中引入

  1. <link href="css/font-awesome.min.css" rel="stylesheet">
也想出现在这里?联系我们
创客主机

HTML 结构

  1. <div class="container">
  2.     <div class="row">
  3.         <div class="col-md-12">
  4.             <div class="main-timeline">
  5.                 <div class="timeline">
  6.                     <a href="#" class="timeline-content">
  7.                         <div class="timeline-year">
  8.                             <span>2019</span>
  9.                         </div>
  10.                         <div class="timeline-icon">
  11.                             <i class="fa fa-rocket"></i>
  12.                         </div>
  13.                         <h3 class="title">Web Development</h3>
  14.                         <p class="description">
  15.                             ......
  16.                         </p>
  17.                     </a>
  18.                 </div>
  19.                 <div class="timeline">
  20.                     <a href="#" class="timeline-content">
  21.                         <div class="timeline-year">
  22.                             <span>2018</span>
  23.                         </div>
  24.                         <div class="timeline-icon">
  25.                             <i class="fa fa-globe"></i>
  26.                         </div>
  27.                         <h3 class="title">Web Designing</h3>
  28.                         <p class="description">
  29.                             ......
  30.                         </p>
  31.                     </a>
  32.                 </div>
  33.             </div>
  34.         </div>
  35.     </div>
  36. </div>

CSS 样式

  1. .main-timeline{ font-family: 'Roboto', sans-serif; }
  2. .main-timeline:after{
  3.     content: '';
  4.     display: block;
  5.     clear: both;
  6. }
  7. .main-timeline:before{
  8.     content: '';
  9.     height: 100%;
  10.     width: 2px;
  11.     border: 2px dashed #000;
  12.     transform: translateX(-50%);
  13.     position: absolute;
  14.     left: 50%;
  15.     top: 30px;
  16. }
  17. .main-timeline .timeline{
  18.     width: 50%;
  19.     padding: 100px 70px 0 25px;
  20.     margin: 0 50px 0 0;
  21.     float: left;
  22.     position: relative;
  23. }
  24. .main-timeline .timeline-content{
  25.     padding: 15px 15px 15px 40px;
  26.     border: 2px solid #00A79B;
  27.     border-radius: 15px 0 15px 15px;
  28.     display: block;
  29.     position: relative;
  30. }
  31. .main-timeline .timeline-content:hover{ text-decoration: none; }
  32. .main-timeline .timeline-content:after{
  33.     content: '';
  34.     background-color: #00A79B;
  35.     height: 18px;
  36.     width: 15px;
  37.     position: absolute;
  38.     right: -15px;
  39.     top: -2px;
  40.     clip-path: polygon(100% 0, 0 0, 0 100%);
  41. }
  42. .main-timeline .timeline-year{
  43.     color: #fff;
  44.     background-color: #00A79B;
  45.     font-size: 32px;
  46.     font-weight: 900;
  47.     text-align: center;
  48.     line-height: 98px;
  49.     height: 100px;
  50.     width: 100px;
  51.     border-radius: 50%;
  52.     position: absolute;
  53.     right: -120px;
  54.     top:-85px;
  55. }
  56. .main-timeline .timeline-year:after{
  57.     content: '';
  58.     height: 130px;
  59.     width: 130px;
  60.     border: 8px solid #00A79B;
  61.     border-left-color: transparent;
  62.     border-radius: 50%;
  63.     transform: translateX(-50%) translateY(-50%) rotate(-20deg);
  64.     position: absolute;
  65.     left: 50%;
  66.     top: 50%;
  67. }
  68. .main-timeline .timeline-icon{
  69.     color: #fff;
  70.     background-color: #00A79B;
  71.     font-size: 35px;
  72.     text-align: center;
  73.     line-height: 50px;
  74.     height: 50px;
  75.     width: 50px;
  76.     border-radius: 50%;
  77.     transform: translateY(-50%);
  78.     position: absolute;
  79.     top: 50%;
  80.     left: -25px;
  81.     transition: all 0.3s;
  82. }
  83. .main-timeline .title{
  84.     color: #222;
  85.     font-size: 20px;
  86.     font-weight: 900;
  87.     text-transform: uppercase;
  88.     letter-spacing: 1px;
  89.     margin: 0 0 7px 0;
  90. }
  91. .main-timeline .description{
  92.     color: #222;
  93.     font-size: 15px;
  94.     letter-spacing: 1px;
  95.     text-align: justify;
  96.     margin: 0 0 5px;
  97. }
  98. .main-timeline .timeline:nth-child(even){
  99.     padding: 100px 25px 0 70px;
  100.     margin: 0 0 0 50px;
  101.     float: right;
  102. }
  103. .main-timeline .timeline:nth-child(even) .timeline-content{
  104.     padding: 15px 40px 15px 15px;
  105.     border-radius: 0 15px 15px 15px;
  106. }
  107. .main-timeline .timeline:nth-child(even) .timeline-content:after{
  108.     transform: rotateY(180deg);
  109.     right: auto;
  110.     left: -15px;
  111. }
  112. .main-timeline .timeline:nth-child(even) .timeline-year{
  113.     right: auto;
  114.     left: -120px;
  115. }
  116. .main-timeline .timeline:nth-child(even) .timeline-year:after{
  117.     transform: translateX(-50%) translateY(-50%) rotate(200deg);
  118. }
  119. .main-timeline .timeline:nth-child(even) .timeline-icon{
  120.     left: auto;
  121.     right: -25px;
  122. }
  123. .timeline:nth-child(4n+2) .timeline-content,
  124. .timeline:nth-child(4n+2) .timeline-year:after{
  125.     border-color: #9E005D;
  126. }
  127. .timeline:nth-child(4n+2) .timeline-year:after{ border-left-color: transparent; }
  128. .timeline:nth-child(4n+2) .timeline-content:after,
  129. .timeline:nth-child(4n+2) .timeline-icon,
  130. .timeline:nth-child(4n+2) .timeline-year{
  131.     background-color: #9E005D;
  132. }
  133. .timeline:nth-child(4n+3) .timeline-content,
  134. .timeline:nth-child(4n+3) .timeline-year:after{
  135.     border-color: #f24f0e;
  136. }
  137. .timeline:nth-child(4n+3) .timeline-year:after{ border-left-color: transparent; }
  138. .timeline:nth-child(4n+3) .timeline-content:after,
  139. .timeline:nth-child(4n+3) .timeline-icon,
  140. .timeline:nth-child(4n+3) .timeline-year{
  141.     background-color: #f24f0e;
  142. }
  143. .timeline:nth-child(4n+4) .timeline-content,
  144. .timeline:nth-child(4n+4) .timeline-year:after{
  145.     border-color: #0870C5;
  146. }
  147. .timeline:nth-child(4n+4) .timeline-year:after{ border-left-color: transparent; }
  148. .timeline:nth-child(4n+4) .timeline-content:after,
  149. .timeline:nth-child(4n+4) .timeline-icon,
  150. .timeline:nth-child(4n+4) .timeline-year{
  151.     background-color: #0870C5;
  152. }
  153. @media screen and (max-width:767px){
  154.     .main-timeline:before{ display: none; }
  155.     .main-timeline .timeline{
  156.         width: 100%;
  157.         padding-top: 80px;
  158.         padding-right: 12px;
  159.         margin-bottom: 20px;
  160.     }
  161.     .main-timeline .timeline:nth-child(even){
  162.         padding-left: 10px;
  163.         padding-top: 80px;
  164.         margin-bottom: 20px;
  165.     }
  166.     .main-timeline .timeline-content,
  167.     .main-timeline .main-timeline .timeline:nth-child(even) .timeline-content{
  168.         background-color: #fff;
  169.         padding-top: 25px;
  170.     }
  171.     .main-timeline .timeline-content:after{ display: none; }
  172.     .main-timeline .timeline-year{
  173.         font-size: 24px;
  174.         line-height: 70px;
  175.         height: 70px;
  176.         width: 70px;
  177.         right: 0;
  178.         top: -65px;
  179.     }
  180.     .main-timeline .timeline-year:after{ display: none; }
  181.     .main-timeline .timeline:nth-child(even) .timeline-year{ left: 3px; }
  182. }
  183. @media screen and (max-width:567px){
  184.     .main-timeline .title{ font-size: 18px; }
  185. }

垂直时间轴特效 CSS3 代码

已有 385 人购买
  • k699
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!