网页中时光轴CSS如何实现

春季是一个富有生命力季节,也是一个美丽、神奇,充满希望季节。柳树枝条向下垂着,就似一条条线挂树上。春季景色十分美丽,就似一幅栩栩如生画。

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

效果图:

实现代码:

XML/HTML Code复制内容到剪贴板
  1. <!DOCTYPEhtml>
  2. <htmllang="en">
  3. <head>
  4. <metacharset="UTF-8">
  5. <title>时光轴</title>
  6. <style>
  7. .container{
  8. width:800px;
  9. margin:50pxauto;
  10. }
  11. .vertical-timeline{
  12. color:#FFF;
  13. font-family:"微软雅黑","MicrosoftYaHei";
  14. }
  15. .vertical-timeline-block{
  16. width:100%;
  17. border-left:2pxsolid#DDD;
  18. margin:020px;
  19. position:relative;
  20. padding-bottom:30px;
  21. }
  22. /*时间轴的左侧图标*/
  23. .vertical-timeline-icon{
  24. width:40px;
  25. height:40px;
  26. border-radius:20px;
  27. position:absolute;
  28. left:-22px;
  29. top:10px;
  30. text-align:center;
  31. line-height:40px;
  32. cursor:pointer;
  33. transition:all0.2sease-in;
  34. -webkit-transition:all0.2sease-in;
  35. -moz-transition:all0.2sease-in;
  36. -o-transition:all0.2sease-in;
  37. }
  38. .vertical-timeline-block{
  39. cursor:pointer;
  40. }
  41. .vertical-timeline-block:hover.vertical-timeline-icon{
  42. width:50px;
  43. height:50px;
  44. border-radius:25px;
  45. line-height:50px;
  46. left:-27px;
  47. box-shadow:005px#CCC;
  48. font-size:25px;
  49. }
  50. /*时间轴的左侧图标的各种样式*/
  51. .v-timeline-icon1{
  52. background-color:#2aabd2;
  53. }
  54. .v-timeline-icon2{
  55. background-color:#5cb85c;
  56. }
  57. .v-timeline-icon3{
  58. background-color:#8c8c8c;
  59. }
  60. /*时间轴的左侧图标上的序号*/
  61. .vertical-timeline-iconi{
  62. font-style:normal;
  63. color:#FFF;
  64. }
  65. /*时间轴上的具体内容*/
  66. .vertical-timeline-content{
  67. background-color:#5bc0de;
  68. margin-left:60px;
  69. padding:20px30px;
  70. border-radius:5px;
  71. position:relative;
  72. }
  73. /*时间轴上的具体内容左侧箭头*/
  74. .vertical-timeline-content:before{
  75. content:'';
  76. width:0;
  77. height:0;
  78. border-top:10pxsolidtransparent;
  79. border-bottom:10pxsolidtransparent;
  80. border-right:10pxsolid#5bc0de;
  81. border-left:10pxsolidtransparent;
  82. position:absolute;
  83. right:100%;
  84. top:20px;
  85. }
  86. /*时间轴的具体内容的格式*/
  87. .timeline-content{
  88. text-indent:2em;
  89. }
  90. .time-more{
  91. overflow:hidden;
  92. }
  93. .time-more.time{
  94. float:left;
  95. line-height:40px;
  96. display:inline-block;
  97. }
  98. .time-more.more{
  99. float:right;
  100. }
  101. .time-more.morea{
  102. display:inline-block;
  103. height:20px;
  104. padding:8px15px;
  105. color:#FFF;
  106. text-decoration:none;
  107. font-size:15px;
  108. }
  109. /*“更多信息”的风格*/
  110. .more-style1{
  111. border-radius:5px;
  112. background-color:#565656;
  113. }
  114. .more-style1:hover{
  115. background-color:#696969;
  116. }
  117. .more-style2{
  118. border-radius:5px;
  119. background-color:#1AB394;
  120. }
  121. .more-style2:hover{
  122. background-color:#18A689;
  123. }
  124. .more-style3{
  125. border-radius:5px;
  126. background-color:#1C84C6;
  127. }
  128. .more-style3:hover{
  129. background-color:#1A7BB9;
  130. }
  131. </style>
  132. </head>
  133. <body>
  134. <divclass="container">
  135. <divclass="vertical-timeline">
  136. <divclass="vertical-timeline-block">
  137. <divclass="vertical-timeline-iconv-timeline-icon1">
  138. <iclass="icon">1</i>
  139. </div>
  140. <divclass="vertical-timeline-content">
  141. <h2>时间点1</h2>
  142. <pclass="timeline-content">我去吃了个午饭</p>
  143. <pclass="time-more">
  144. <spanclass="time">2016/4/3013:48</span>
  145. <spanclass="moremore-style1"><arel="nofollow noopener noreferrer" href="#">更多信息</a></span>
  146. </p>
  147. </div>
  148. </div>
  149. <divclass="vertical-timeline-block">
  150. <divclass="vertical-timeline-iconv-timeline-icon2">
  151. <iclass="icon">2</i>
  152. </div>
  153. <divclass="vertical-timeline-content">
  154. <h2>时间点2</h2>
  155. <pclass="timeline-content">我去吃了个午饭</p>
  156. <pclass="time-more">
  157. <spanclass="time">2016/4/3013:48</span>
  158. <spanclass="moremore-style2"><arel="nofollow noopener noreferrer" href="#">更多信息</a></span>
  159. </p>
  160. </div>
  161. </div>
  162. <divclass="vertical-timeline-block">
  163. <divclass="vertical-timeline-iconv-timeline-icon3">
  164. <iclass="icon">3</i>
  165. </div>
  166. <divclass="vertical-timeline-content">
  167. <h2>时间点3</h2>
  168. <pclass="timeline-content">我去吃了个午饭</p>
  169. <pclass="time-more">
  170. <spanclass="time">2016/4/3013:48</span>
  171. <spanclass="moremore-style3"><arel="nofollow noopener noreferrer" href="#">更多信息</a></span>
  172. </p>
  173. </div>
  174. </div>
  175. <divclass="vertical-timeline-block">
  176. <divclass="vertical-timeline-iconv-timeline-icon1">
  177. <iclass="icon">4</i>
  178. </div>
  179. <divclass="vertical-timeline-content">
  180. <h2>时间点1</h2>
  181. <h2>时间点1</h2>
  182. <h2>时间点1</h2>
  183. <h2>时间点1</h2>
  184. </div>
  185. </div>
  186. <divclass="vertical-timeline-block">
  187. <divclass="vertical-timeline-iconv-timeline-icon2">
  188. <iclass="icon">5</i>
  189. </div>
  190. <divclass="vertical-timeline-content">
  191. <h2>时间点1</h2>
  192. <h2>时间点1</h2>
  193. <h2>时间点1</h2>
  194. </div>
  195. </div>
  196. <divclass="vertical-timeline-block">
  197. <divclass="vertical-timeline-iconv-timeline-icon3">
  198. <iclass="icon">6</i>
  199. </div>
  200. <divclass="vertical-timeline-content">
  201. <h2>时间点1</h2>
  202. <h2>时间点1</h2>
  203. <h2>时间点1</h2>
  204. </div>
  205. </div>
  206. </div>
  207. </div>
  208. </body>
  209. </html>

以上就是本文的全部内容,希望对大家的学习有所帮助。

标签: 中时