导航菜单

纯CSS3单页切换导航菜单界面设计

阿里云


这是一款使用纯 CSS3 制作的单页切换导航菜单界面设计效果。该页面效果中,在页面的左侧垂直排放一组导航按钮,当点击导航按钮时,相应的页面会从屏幕右侧滑动出来,效果非常炫酷。

HTML 结构

该单页切换导航菜单界面的 HTML 结构如下:

也想出现在这里?联系我们
创客主机
  1. <div class="ct" id="t1">
  2.   <div class="ct" id="t2">
  3.     <div class="ct" id="t3">
  4.       <div class="ct" id="t4">
  5.          <div class="ct" id="t5">
  6.           <ul id="menu">
  7.             <a href="#t1"><li class="icon fa fa-bolt" id="uno"></li></a>
  8.             <a href="#t2"><li class="icon fa fa-keyboard-o" id="dos"></li></a>
  9.             <a href="#t3"><li class="icon fa fa-rocket" id="tres"></li></a>
  10.             <a href="#t4"><li class="icon fa fa-dribbble" id="cuatro"></li></a>
  11.             <a href="#t5"><li class="icon fa fa-plus-circle" id="cinco"></li></a>
  12.           </ul>
  13.           <div class="page" id="p1">
  14.              <section class="icon fa fa-bolt"><span class="title">Bolt</span><span class="hint">...</section>  
  15.           </div>
  16.           <div class="page" id="p2">
  17.             <section class="icon fa fa-keyboard-o"><span class="title">Type</span></section>
  18.           </div>  
  19.           <div class="page" id="p3">
  20.             <section class="icon fa fa-rocket"><span class="title">Rocket</span></section>
  21.           </div>
  22.           <div class="page" id="p4">
  23.             <section class="icon fa fa-dribbble">
  24.               <span class="title">Dribbble</span>
  25.               <p class="hint">
  26.                 Im ready to play, <span class="hint line-trough">invite me </span> find me
  27.               </p>
  28.               <p class="hint">...</p>
  29.             </section>
  30.           </div> 
  31.           <div class="page" id="p5">
  32.             <section class="icon fa fa-plus-circle">
  33.               <span class="title">More</span>
  34.               <p class="hint">
  35.                 ...
  36.               </p>
  37.             </section>
  38.           </div> 
  39.         </div>
  40.       </div>
  41.     </div>
  42.   </div>
  43. </div>

CSS 样式

该单页切换导航菜单界面使用 transform 和 transition 来制作页面的切换动画效果。并通过:target 伪元素来完成按钮点击时的页面切换。完整的 CSS 代码如下,代码中没有添加浏览器厂商的前缀。

  1. html, body, .page {
  2.   width: 100%;
  3.   height: 100%;
  4.   margin: 0;
  5.   padding: 0;
  6.   transition: all .6s cubic-bezier(.5, .2, .2, 1.1);
  7.   color: #fff;
  8.   overflow: hidden; 
  9. }
  10.  
  11. * {
  12.   font-family: 'open sans', 'lato', 'helvetica', sans-serif;
  13. }
  14.  
  15. .page {
  16.   position: absolute;
  17. }
  18.  
  19. #p1 {
  20.   left: 0;
  21. }
  22.  
  23. #p2, #p3, #p4, #p5 {
  24.   left: 200%;
  25. }
  26.  
  27. #p1 { background: darkslateblue; }
  28. #p2 { background: tomato; }
  29. #p3 { background: gold; }
  30. #p4 { background: deeppink; }
  31. #p5 { background: #9b59b6; }
  32.  
  33. #t2:target #p2,
  34. #t3:target #p3,
  35. #t4:target #p4,
  36. #t5:target #p5 {
  37.   transform: translateX(-190%);
  38.   transition-delay: .4s !important;
  39. }
  40.  
  41. #t2:target #p1, 
  42. #t3:target #p1,
  43. #t4:target #p1,
  44. #t5:target #p1{
  45.   background: black;
  46. }
  47.  
  48. #t2:target #p1 .icon, 
  49. #t3:target #p1 .icon,
  50. #t4:target #p1 .icon,
  51. #t5:target #p1 .icon {
  52.   -webkit-filter: blur(3px);
  53.   filter: blur(3px);
  54. }
  55.  
  56. .icon {
  57.   color: #fff;
  58.   font-size: 32px;
  59.   display: block;
  60. }
  61.  
  62. ul .icon:hover {
  63.   opacity: 0.5;
  64. }
  65.  
  66. .page .icon .title {
  67.   line-height: 2;
  68. }
  69.  
  70. #t2:target ul .icon,
  71. #t3:target ul .icon,
  72. #t4:target ul .icon,
  73. #t5:target ul .icon{
  74.   transform: scale(.6);
  75.   transition-delay: .25s;
  76. }
  77.  
  78. #t2:target #dos,
  79. #t3:target #tres,
  80. #t4:target #cuatro,
  81. #t4:target #cinco {
  82.   transform: scale(1.2) !important;
  83. }
  84.  
  85. ul {
  86.   position: fixed;
  87.   z-index: 1;
  88.   top: 0;
  89.   bottom: 0;
  90.   left: 0;
  91.   margin: auto;
  92.   height: 280px;
  93.   width: 10%;
  94.   padding: 0;
  95.   text-align: center;
  96.  }
  97.  
  98. #menu .icon {
  99.   margin: 30px 0;
  100.   transition: all .5s ease-out !important;
  101. }
  102.  
  103. a {
  104.   text-decoration: none;
  105. }
  106.  
  107. .title, .hint {
  108.   display: block;
  109. }
  110.  
  111. .title {
  112.   font-size: 38px;
  113. }
  114.  
  115. .hint {
  116.   font-size: 13px;
  117. }
  118.  
  119. #p4 .hint {
  120.   display: inherit !important;
  121. }
  122.  
  123. .hint a {
  124.   color: yellow;
  125.   transition: all 250ms ease-out;
  126. }
  127.  
  128. .hint a:hover {
  129.   color: #FFF;
  130. }
  131.  
  132. .line-trough {
  133.   text-decoration: line-through;
  134. }
  135.  
  136. .page .icon {
  137.   position: absolute;
  138.   top: 0;
  139.   bottom: 0;
  140.   right: 10%;
  141.   left: 0;
  142.   width: 270px;
  143.   height: 170px;
  144.   margin: auto;
  145.   text-align: center;
  146.   font-size: 80px;
  147.   line-height: 1.3;
  148.   transform: translateX(360%);
  149.   transition: all .5s cubic-bezier(.25, 1, .5, 1.25);
  150. }
  151.  
  152. .page#p1 .icon {
  153.   height: 220px;
  154. }
  155.  
  156. .page#p1 .icon {
  157.   transform: translateX(10%) !important;
  158. }
  159.  
  160. #t2:target .page#p2 .icon,
  161. #t3:target .page#p3 .icon,
  162. #t4:target .page#p4 .icon,
  163. #t5:target .page#p5 .icon {
  164.   transform: translateX(0) !important;
  165.   transition-delay: 1s;
  166. }

纯 CSS3 单页切换导航菜单界面设计

已有 492 人购买
  • veza
查看演示升级 VIP立刻购买

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

发表回复

热销模板

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

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