DIV CSS 佈局教程網

 DIV+CSS佈局教程網 >> 網頁腳本 >> CSS入門知識 >> CSS詳解 >> 一款純css實現的漂亮導航菜單(也適用於個人中心)
一款純css實現的漂亮導航菜單(也適用於個人中心)
編輯:CSS詳解     
之前已經分享很多css3實現的導航菜單,今天再分享一款純CSS實現的漂亮導航,這款也是適合放在個人中心。還帶來圖標,效果不錯。需要的朋友可以參考下

  今天給大家分享一款純CSS實現的漂亮導航。之前為大家分享過jquery實現的個人中心導航菜單,今天這款也是適合放在個人中心。還帶來圖標,效果不錯。一起看下效果圖:

  實現的代碼。

  Html代碼:

XML/Html Code復制內容到剪貼板
  1. <div class="l-main">
  2. <div class="menu">
  3. <header class="menu__header">
  4. <h1 class="menu__header-title">
  5. Incoming Messages</h1>
  6. </header>
  7. <div class="menu__body">
  8. <ul class="nav">
  9. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link is-active">
  10. <i class="fa fa-envelope nav__item-icon"></i><span class="nav__item-text">News</span>
  11. <span class="badge badge--warning">32</span> </a></li>
  12. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-flag nav__item-icon">
  13. </i><span class="nav__item-text">Priority</span> <span class="badge">8</span> </a>
  14. </li>
  15. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-space-shuttle nav__item-icon">
  16. </i><span class="nav__item-text">Assigned</span> <span class="badge">0/17</span> </a>
  17. </li>
  18. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-archive nav__item-icon">
  19. </i><span class="nav__item-text">Archived</span> <span class="badge">3</span> </a>
  20. </li>
  21. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-trash nav__item-icon">
  22. </i><span class="nav__item-text">Deleted</span> <span class="badge">9</span> </a>
  23. </li>
  24. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><span class="nav__item-text">
  25. Show all</span> </a></li>
  26. </ul>
  27. </div>
  28. </div>
  29. <div class="menu menu--small">
  30. <header class="menu__header">
  31. <h1 class="menu__header-title">
  32. Incoming</h1>
  33. </header>
  34. <div class="menu__body">
  35. <ul class="nav">
  36. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link is-active"><i class="fa fa-envelope nav__item-icon">
  37. </i><span class="badge badge--warning">32</span> </a></li>
  38. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-flag nav__item-icon">
  39. </i><span class="badge">8</span> </a></li>
  40. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-space-shuttle nav__item-icon">
  41. </i><span class="badge">0/17</span> </a></li>
  42. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-archive nav__item-icon">
  43. </i><span class="badge">3</span> </a></li>
  44. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><i class="fa fa-trash nav__item-icon">
  45. </i><span class="badge">9</span> </a></li>
  46. <li class="nav__item"><a href="http://www.jb51.Net" class="nav__item-link"><span class="nav__item-text">
  47. Show all</span> </a></li>
  48. </ul>
  49. </div>
  50. </div>
  51. </div>

  CSS代碼:

CSS Code復制內容到剪貼板
  1. body
  2. {
  3. background: #F4F4F4;
  4. font-family: Arial, sans-serif;
  5. font-size: 14px;
  6. font-weight: lighter;
  7. }
  8. .l-main
  9. {
  10. width: 530px;
  11. margin: 0 auto;
  12. }
  13. .menu
  14. {
  15. width: 250px;
  16. margin: 40px;
  17. background: #fff;
  18. box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  19. border-radius: 5px;
  20. float: left;
  21. }
  22. .menu__header
  23. {
  24. background: #4B4F55;
  25. border-bottom: 1px solid #353A40;
  26. border-radius: 5px 5px 0 0;
  27. }
  28. .menu__header-title
  29. {
  30. color: #fff;
  31. padding: 15px;
  32. text-shadow: 0 1px 0 rgba(0, 0, 0, 0.4);
  33. }
  34. .menu__body
  35. {
  36. border-radius: 0 0 5px 5px;
  37. }
  38. .menu--small
  39. {
  40. width: 110px;
  41. }
  42. .nav
  43. {
  44. list-style: none;
  45. }
  46. .nav__item
  47. {
  48. position: relative;
  49. }
  50. .nav__item-link
  51. {
  52. padding: 10px 15px;
  53. text-decoration: none;
  54. color: #8B8E93;
  55. display: block;
  56. border-bottom: 1px solid #F0F0F0;
  57. }
  58. .nav__item-link:hover
  59. {
  60. background: #f0f0f0;
  61. }
  62. .nav__item-link.is-active
  63. {
  64. background: #6E757F;
  65. color: #fff;
  66. border-bottom-color: #4B4F55;
  67. box-shadow: 0 1px 0 #7A828D inset;
  68. }
  69. .nav__item-link.is-active:after
  70. {
  71. content: '';
  72. display: block;
  73. position: absolute;
  74. top: 50%;
  75. rightright: -6px;
  76. margin-top: -6px;
  77. border-top: 6px solid transparent;
  78. border-bottom: 6px solid transparent;
  79. border-left: 6px solid #6E757F;
  80. }
  81. .nav__item-link.is-active .nav__item-icon
  82. {
  83. color: #fff;
  84. }
  85. .nav__item:last-child .nav__item-link
  86. {
  87. border-bottom: none;
  88. }
  89. .nav__item-icon
  90. {
  91. color: #D2D5DA;
  92. width: 20px;
  93. text-align: center;
  94. font-size: 18px;
  95. margin-right: 10px;
  96. }
  97. .badge
  98. {
  99. font-size: 12px;
  100. padding: 2px 8px;
  101. border: 1px solid #D1D1D1;
  102. border-radius: 10px;
  103. position: absolute;
  104. top: 10px;
  105. rightright: 15px;
  106. }
  107. .badge--warning
  108. {
  109. background: #ED373F;
  110. border-color: #ED373F;
  111. }

  以上就是今天分享的一款純CSS實現的漂亮導航。謝謝閱讀,希望能幫到大家,請繼續關注,我們會努力分享更多優秀的文章。

XML學習教程| jQuery入門知識| AJAX入門| Dreamweaver教程| Fireworks入門知識| SEO技巧| SEO優化集錦|
Copyright © DIV+CSS佈局教程網 All Rights Reserved