南强小屋 Design By 杰米

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

纯CSS3单页切换导航菜单界面设计的简单实现

 使用方法

 HTML结构

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

XML/HTML Code复制内容到剪贴板
  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代码如下,代码中没有添加浏览器厂商的前缀。

CSS Code复制内容到剪贴板
  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.   bottombottom: 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.   bottombottom: 0;   
  140.   rightright: 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单页切换导航菜单界面设计的简单实现就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持。

标签:
CSS3,导航,菜单,界面

南强小屋 Design By 杰米
广告合作:本站广告合作请联系QQ:858582 申请时备注:广告合作(否则不回)
免责声明:本站文章均来自网站采集或用户投稿,网站不提供任何软件下载或自行开发的软件! 如有用户或公司发现本站内容信息存在侵权行为,请邮件告知! 858582#qq.com
南强小屋 Design By 杰米

评论“纯CSS3单页切换导航菜单界面设计的简单实现”

暂无纯CSS3单页切换导航菜单界面设计的简单实现的评论...

P70系列延期,华为新旗舰将在下月发布

3月20日消息,近期博主@数码闲聊站 透露,原定三月份发布的华为新旗舰P70系列延期发布,预计4月份上市。

而博主@定焦数码 爆料,华为的P70系列在定位上已经超过了Mate60,成为了重要的旗舰系列之一。它肩负着重返影像领域顶尖的使命。那么这次P70会带来哪些令人惊艳的创新呢?

根据目前爆料的消息来看,华为P70系列将推出三个版本,其中P70和P70 Pro采用了三角形的摄像头模组设计,而P70 Art则采用了与上一代P60 Art相似的不规则形状设计。这样的外观是否好看见仁见智,但辨识度绝对拉满。