您现在的位置是:网站首页> 编程资料编程资料

网页中时光轴CSS实现_CSS教程_CSS_网页制作_

2021-09-13 1111人已围观

简介 这篇文章为大家分享了CSS网页中时光轴的简单实现方法,记录每个时间段、时间点所发生的事情,具有一定的参考价值,感兴趣的小伙伴们可以参考一下

本文实例为大家分享了网页中时光轴的制作方法,供大家参考,具体内容如下

效果图:

实现代码:

XML/HTML Code复制内容到剪贴板
  1. >     
  2. <html lang="en">     
  3. <head>     
  4.     <meta charset="UTF-8">     
  5.     <title>时光轴title>     
  6.     <style>     
  7.         .container {     
  8.             width: 800px;     
  9.             margin: 50px auto;     
  10.         }     
  11.      
  12.         .vertical-timeline {     
  13.             color: #FFF;     
  14.             font-family: "微软雅黑", "Microsoft YaHei";     
  15.         }     
  16.      
  17.         .vertical-timeline-block {     
  18.             width: 100%;     
  19.             border-left: 2px solid #DDD;     
  20.             margin: 0 20px;     
  21.             position: relative;     
  22.             padding-bottom: 30px;     
  23.         }     
  24.      
  25.         /* 时间轴的左侧图标 */     
  26.         .vertical-timeline-icon {     
  27.             width: 40px;     
  28.             height: 40px;     
  29.             border-radius: 20px;     
  30.             position: absolute;     
  31.             left: -22px;     
  32.             top: 10px;     
  33.      
  34.             text-align: center;     
  35.             line-height: 40px;     
  36.             cursor: pointer;     
  37.             transition: all 0.2s ease-in;     
  38.             -webkit-transition: all 0.2s ease-in;     
  39.             -moz-transition: all 0.2s ease-in;     
  40.             -o-transition: all 0.2s ease-in;     
  41.         }     
  42.         .vertical-timeline-block {     
  43.             cursor: pointer;     
  44.         }     
  45.         .vertical-timeline-block:hover .vertical-timeline-icon {     
  46.             width: 50px;     
  47.             height: 50px;     
  48.             border-radius: 25px;     
  49.             line-height: 50px;     
  50.             left: -27px;     
  51.             box-shadow: 0 0 5px #CCC;     
  52.             font-size: 25px;     
  53.         }     
  54.      
  55.         /* 时间轴的左侧图标的各种样式 */     
  56.         .v-timeline-icon1 {     
  57.             background-color: #2aabd2;     
  58.         }     
  59.         .v-timeline-icon2 {     
  60.             background-color: #5cb85c;     
  61.         }     
  62.         .v-timeline-icon3 {     
  63.             background-color: #8c8c8c;     
  64.         }     
  65.         /* 时间轴的左侧图标上的序号*/     
  66.         .vertical-timeline-icon i {     
  67.             font-style: normal;     
  68.             color: #FFF;     
  69.         }     
  70.         /* 时间轴上的具体内容 */     
  71.         .vertical-timeline-content {     
  72.             background-color: #5bc0de;     
  73.             margin-left: 60px;     
  74.             padding: 20px 30px;     
  75.             border-radius: 5px;     
  76.             position: relative;     
  77.         }     
  78.         /* 时间轴上的具体内容左侧箭头 */     
  79.         .vertical-timeline-content:before {     
  80.             content: '';     
  81.             width: 0;     
  82.             height: 0;     
  83.      
  84.             border-top: 10px solid transparent;     
  85.             border-bottom: 10px solid transparent;     
  86.             border-right: 10px solid #5bc0de;     
  87.             border-left: 10px solid transparent;     
  88.      
  89.             position: absolute;     
  90.             right: 100%;     
  91.             top: 20px;     
  92.         }     
  93.         /* 时间轴的具体内容的格式 */     
  94.         .timeline-content {     
  95.             text-indent: 2em;     
  96.         }     
  97.         .time-more {     
  98.             overflow: hidden;     
  99.         }     
  100.         .time-more .time {     
  101.             float: left;     
  102.             line-height: 40px;     
  103.             display: inline-block;     
  104.         }     
  105.         .time-more .more {     
  106.             float: right;     
  107.         }     
  108.         .time-more .more a {     
  109.             display: inline-block;     
  110.             height: 20px;     
  111.             padding: 8px 15px;     
  112.             color: #FFF;     
  113.             text-decoration: none; &

-六神源码网