经验首页 前端设计 程序设计 Java相关 移动开发 数据库/运维 软件/图像 大数据/云计算 其他经验
当前位置:技术经验 » HTML/CSS » CSS3 » 查看文章
CSS3实现的侧滑菜单_css3_CSS
来源:jb51  时间:2021/5/6 19:38:54  对本文有异议

实现效果:

实现代码:

  1. <!DOCTYPE html><html class="menu">
  2. <html>
  3.  
  4. <head>
  5.  
  6. <meta charset="utf-8"/>
  7. <meta http-equiv="X-UA-Compatible" content=="IE=edge"/>
  8. <meta name="google" value="notranslate"/>
  9. <title>Side Menu</title>
  10.  
  11. <link rel="stylesheet" type="text/css" href="css/menu.css">
  12. <link rel="stylesheet" type="text/css" href="https://netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
  13.  
  14.  
  15.  
  16.  
  17.  
  18. </head>
  19. <body>
  20.  
  21.  
  22.  
  23. </div><nav class="main-menu">
  24.  
  25.  
  26. <div>
  27. <a class="logo" href="http://startific.com">
  28. </a>
  29. </div>
  30. <div class="settings"></div>
  31. <div class="scrollbar" id="style-1">
  32. <ul>
  33. <li>
  34. <a href="http://startific.com">
  35. <i class="fa fa-home fa-lg"></i>
  36. <span class="nav-text">Home</span>
  37. </a>
  38. </li>
  39. <li>
  40. <a href="http://startific.com">
  41. <i class="fa fa-user fa-lg"></i>
  42. <span class="nav-text">Login</span>
  43. </a>
  44. </li>
  45.  
  46. <li>
  47. <a href="http://startific.com">
  48. <i class="fa fa-envelope-o fa-lg"></i>
  49. <span class="nav-text">Contact</span>
  50. </a>
  51. </li>
  52.  
  53.  
  54. <li>
  55. <a href="http://startific.com">
  56. <i class="fa fa-heart-o fa-lg"></i>
  57. <span class="share">
  58.  
  59.  
  60. <div class="addthis_default_style addthis_32x32_style">
  61. <div style="position:absolute;
  62. margin-left: 56px;top:3px;">
  63.  
  64. <a href="https://www.facebook.com/sharer/sharer.php?u=" target="_blank" class="share-popup"><img src="http://icons.iconarchive.com/icons/danleech/simple/512/facebook-icon.png" width="30px" height="30px"></a>
  65.  
  66. <a href="https://twitter.com/share" target="_blank" class="share-popup"><img src="https://cdn1.iconfinder.com/data/icons/metro-ui-dock-icon-set--icons-by-dakirby/512/Twitter_alt.png" width="30px" height="30px"></a>
  67.  
  68.  
  69.  
  70. <a href="https://plusone.google.com/_/+1/confirm?hl=en&url=_URL_&title=_TITLE_
  71. " target="_blank" class="share-popup"><img src="http://icons.iconarchive.com/icons/danleech/simple/512/google-plus-icon.png" width="30px" height="30px"></a>
  72. </div>
  73. <script type="text/javascript">var addthis_config = {"data_track_addressbar":true};</script>
  74. <script type="text/javascript" src="//s7.addthis.com/js/300/addthis_widget.js#pubid=ra-4ff17589278d8b3a"></script>
  75. </span>
  76. <span class="twitter"></span>
  77. <span class="google"></span>
  78. <span class="fb-like">
  79. <iframe src="//www.facebook.com/plugins/like.php?href=http%3A%2F%2Ffacebook.com%2Fstartific&amp;width&amp;layout=button&amp;action=like&amp;show_faces=false&amp;share=false&amp;height=35" scrolling="no" frameborder="0" style="border:none; overflow:hidden; height:35px;" allowTransparency="true"></iframe>
  80. </span>
  81. <span class="nav-text">
  82. </span>
  83. </a>
  84.  
  85. </li>
  86.  
  87. </li>
  88. <li class="darkerlishadow">
  89. <a href="http://startific.com">
  90. <i class="fa fa-clock-o fa-lg"></i>
  91. <span class="nav-text">News</span>
  92. </a>
  93. </li>
  94. <li class="darkerli">
  95. <a href="http://startific.com">
  96. <i class="fa fa-desktop fa-lg"></i>
  97. <span class="nav-text">Technology</span>
  98. </a>
  99. </li>
  100. <li class="darkerli">
  101. <a href="http://startific.com">
  102. <i class="fa fa-plane fa-lg"></i>
  103. <span class="nav-text">Travel</span>
  104. </a>
  105. </li>
  106. <li class="darkerli">
  107. <a href="http://startific.com">
  108. <i class="fa fa-shopping-cart"></i>
  109. <span class="nav-text">Shopping</span>
  110. </a>
  111. </li>
  112. <li class="darkerli">
  113. <a href="http://startific.com">
  114. <i class="fa fa-microphone fa-lg"></i>
  115. <span class="nav-text">Film & Music</span>
  116. </a>
  117. </li>
  118.  
  119. <li class="darkerli">
  120. <a href="http://startific.com">
  121. <i class="fa fa-flask fa-lg"></i>
  122. <span class="nav-text">Web Tools</span>
  123. </a>
  124. </li>
  125. <li class="darkerli">
  126. <a href="http://startific.com">
  127. <i class="fa fa-picture-o fa-lg"></i>
  128. <span class="nav-text">Art & Design</span>
  129. </a>
  130. </li>
  131.  
  132. <li class="darkerli">
  133. <a href="http://startific.com">
  134. <i class="fa fa-align-left fa-lg"></i>
  135. <span class="nav-text">Magazines
  136. </span>
  137. </a>
  138. </li>
  139. <li class="darkerli">
  140. <a href="http://startific.com">
  141. <i class="fa fa-gamepad fa-lg"></i>
  142. <span class="nav-text">Games</span>
  143. </a>
  144. </li>
  145. <li class="darkerli">
  146. <a href="http://startific.com">
  147. <i class="fa fa-glass fa-lg"></i>
  148. <span class="nav-text">Life & Style
  149. </span>
  150. </a>
  151. </li>
  152. <li class="darkerlishadowdown">
  153. <a href="http://startific.com">
  154. <i class="fa fa-rocket fa-lg"></i>
  155. <span class="nav-text">Fun</span>
  156. </a>
  157. </li>
  158. </ul>
  159.  
  160. <li>
  161. <a href="http://startific.com">
  162. <i class="fa fa-question-circle fa-lg"></i>
  163. <span class="nav-text">Help</span>
  164. </a>
  165. </li>
  166. <ul class="logout">
  167. <li>
  168. <a href="http://startific.com">
  169. <i class="fa fa-lightbulb-o fa-lg"></i>
  170. <span class="nav-text">
  171. BLOG
  172. </span>
  173. </a>
  174. </li>
  175. </ul>
  176. </nav>
  177.  
  178. </body>
  179. </html>

CSS3

  1. body
  2. {
  3. margin:0px;
  4. padding:0px;
  5. font-family: "Open Sans", arial;
  6. background:url('https://static.tumblr.com/94eb957a00fd03c0c2f7d26decd71578/u1rhacw/osAmyyh1q/tumblr_static_tumblr_static_gaussian_blur_gradient_desktop_1680x943_wallpaper-393751.jpg');
  7. color:#fff;
  8. font-weight:300;
  9.  
  10. }
  11.  
  12.  
  13. @import url(//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css);
  14. }
  15. @import url(https://fonts.googleapis.com/css?family=Titillium+Web:300);
  16.  
  17. .logo{
  18. }
  19.  
  20. .settings {
  21. height:73px;
  22. float:left;
  23. background:url( https://s3.postimg.org/bqfooag4z/startific.jpg);
  24. background-repeat:no-repeat;
  25. width:250px;
  26. margin:0px;
  27. text-align: center;
  28. font-size:20px;
  29. font-family: 'Strait', sans-serif;
  30.  
  31. }
  32.  
  33.  
  34.  
  35.  
  36.  
  37.  
  38. /* ScrolBar */
  39. .scrollbar
  40. {
  41.  
  42. height: 90%;
  43. width: 100%;
  44. overflow-y: hidden;
  45. overflow-x: hidden;
  46. }
  47.  
  48. .scrollbar:hover
  49. {
  50.  
  51. height: 90%;
  52. width: 100%;
  53. overflow-y: scroll;
  54. overflow-x: hidden;
  55. }
  56.  
  57. /* Scrollbar Style */
  58.  
  59.  
  60.  
  61. #style-1::-webkit-scrollbar-track
  62. {
  63. border-radius: 2px;
  64. }
  65.  
  66. #style-1::-webkit-scrollbar
  67. {
  68. width: 5px;
  69. background-color: #F7F7F7;
  70. }
  71.  
  72. #style-1::-webkit-scrollbar-thumb
  73. {
  74. border-radius: 10px;
  75. -webkit-box-shadow: inset 0 0 6px rgba(0,0,0,.3);
  76. background-color: #BFBFBF;
  77. }
  78. /* Scrollbar End */
  79.  
  80.  
  81.  
  82.  
  83. .fa-lg {
  84. font-size: 1em;
  85. }
  86. .fa {
  87. position: relative;
  88. display: table-cell;
  89. width: 55px;
  90. height: 36px;
  91. text-align: center;
  92. top:12px;
  93. font-size:20px;
  94.  
  95. }
  96.  
  97.  
  98.  
  99. .main-menu:hover, nav.main-menu.expanded {
  100. width:250px;
  101. overflow:hidden;
  102. opacity:1;
  103.  
  104. }
  105.  
  106. .main-menu {
  107. background:#F7F7F7;
  108. position:absolute;
  109. top:0;
  110. bottom:0;
  111. height:100%;
  112. left:0;
  113. width:55px;
  114. overflow:hidden;
  115. -webkit-transition:width .2s linear;
  116. transition:width .2s linear;
  117. -webkit-transform:translateZ(0) scale(1,1);
  118. box-shadow: 1px 0 15px rgba(0, 0, 0, 0.07);
  119. opacity:1;
  120. }
  121.  
  122. .main-menu>ul {
  123. margin:7px 0;
  124.  
  125. }
  126.  
  127. .main-menu li {
  128. position:relative;
  129. display:block;
  130. width:250px;
  131.  
  132.  
  133. }
  134.  
  135. .main-menu li>a {
  136. position:relative;
  137. width:255px;
  138. display:table;
  139. border-collapse:collapse;
  140. border-spacing:0;
  141. color:#8a8a8a;
  142. font-size: 13px;
  143. text-decoration:none;
  144. -webkit-transform:translateZ(0) scale(1,1);
  145. -webkit-transition:all .14s linear;
  146. transition:all .14s linear;
  147. font-family: 'Strait', sans-serif;
  148. border-top:1px solid #f2f2f2;
  149.  
  150. text-shadow: 1px 1px 1px #fff;
  151. }
  152.  
  153.  
  154.  
  155. .main-menu .nav-icon {
  156. position:relative;
  157. display:table-cell;
  158. width:55px;
  159. height:36px;
  160. text-align:center;
  161. vertical-align:middle;
  162. font-size:18px;
  163.  
  164. }
  165.  
  166. .main-menu .nav-text {
  167. position:relative;
  168. display:table-cell;
  169. vertical-align:middle;
  170. width:190px;
  171. font-family: 'Titillium Web', sans-serif;
  172. }
  173.  
  174. .main-menu .share {
  175. }
  176.  
  177.  
  178.  
  179. .main-menu .fb-like {
  180.  
  181. left: 180px;
  182. position:absolute;
  183. top: 15px;
  184. }
  185.  
  186. .main-menu>ul.logout {
  187. position:absolute;
  188. left:0;
  189. bottom:0;
  190. }
  191.  
  192. .no-touch .scrollable.hover {
  193. overflow-y:hidden;
  194.  
  195. }
  196.  
  197. .no-touch .scrollable.hover:hover {
  198. overflow-y:auto;
  199. overflow:visible;
  200. }
  201.  
  202.  
  203. /* Logo Hover Property */
  204.  
  205.  
  206. .settings:hover, settings:focus {
  207. background:url( https://s17.postimg.org/74cl7s05b/logo_hover.jpg);
  208. -webkit-transition: all 0.2s ease-in-out, width 0, height 0, top 0, left 0;
  209. -moz-transition: all 0.2s ease-in-out, width 0, height 0, top 0, left 0;
  210. -o-transition: all 0.2s ease-in-out, width 0, height 0, top 0, left 0;
  211. transition: all 0.2s ease-in-out, width 0, height 0, top 0, left 0;
  212. }
  213.  
  214. .settings:active, settings:focus {
  215. background:url( https://s3.postimg.org/bqfooag4z/startific.jpg);
  216. -webkit-transition: all 0.1s ease-in-out, width 0, height 0, top 0, left 0;
  217. -moz-transition: all 0.1s ease-in-out, width 0, height 0, top 0, left 0;
  218. -o-transition: all 0.1s ease-in-out, width 0, height 0, top 0, left 0;
  219. transition: all 0.1s ease-in-out, width 0, height 0, top 0, left 0;
  220. }
  221.  
  222.  
  223. a:hover,a:focus {
  224. text-decoration:none;
  225. border-left:0px solid #F7F7F7;
  226.  
  227.  
  228.  
  229. }
  230.  
  231. nav {
  232. -webkit-user-select:none;
  233. -moz-user-select:none;
  234. -ms-user-select:none;
  235. -o-user-select:none;
  236. user-select:none;
  237. }
  238.  
  239. nav ul,nav li {
  240. outline:0;
  241. margin:0;
  242. padding:0;
  243. text-transform: uppercase;
  244. }
  245.  
  246.  
  247.  
  248.  
  249. /* Darker element side menu Start*/
  250.  
  251.  
  252. .darkerli
  253. {
  254. background-color:#ededed;
  255. text-transform:capitalize;
  256. }
  257.  
  258. .darkerlishadow
  259. {
  260. background-color:#ededed;
  261. text-transform:capitalize;
  262. -webkit-box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.55);
  263. -moz-box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.55);
  264. box-shadow: inset 0px 5px 5px -4px rgba(50, 50, 50, 0.55);
  265. }
  266.  
  267.  
  268. .darkerlishadowdown
  269. {
  270. background-color:#ededed;
  271. text-transform:capitalize;
  272. -webkit-box-shadow: inset 0px -4px 5px -4px rgba(50, 50, 50, 0.55);
  273. -moz-box-shadow: inset 0px -4px 5px -4px rgba(50, 50, 50, 0.55);
  274. box-shadow: inset 0px -4px 5px -4px rgba(50, 50, 50, 0.55);
  275. }
  276.  
  277. /* Darker element side menu End*/
  278.  
  279.  
  280.  
  281.  
  282. .main-menu li:hover>a,nav.main-menu li.active>a,.dropdown-menu>li>a:hover,.dropdown-menu>li>a:focus,.dropdown-menu>.active>a,.dropdown-menu>.active>a:hover,.dropdown-menu>.active>a:focus,.no-touch .dashboard-page nav.dashboard-menu ul li:hover a,.dashboard-page nav.dashboard-menu ul li.active a {
  283. color:#fff;
  284. background-color:#00bbbb;
  285. text-shadow: 0px 0px 0px;
  286. }
  287. .area {
  288. float: left;
  289. background: #e2e2e2;
  290. width: 100%;
  291. height: 100%;
  292. }
  293. @font-face {
  294. font-family: 'Titillium Web';
  295. font-style: normal;
  296. font-weight: 300;
  297. src: local('Titillium WebLight'), local('TitilliumWeb-Light'), url(http://themes.googleusercontent.com/static/fonts/titilliumweb/v2/anMUvcNT0H1YN4FII8wpr24bNCNEoFTpS2BTjF6FB5E.woff) format('woff');
  298. }

以上就是CSS3实现的侧滑菜单的详细内容,更多关于CSS3 侧滑菜单的资料请关注w3xue其它相关文章!

 友情链接:直通硅谷  点职佳  北美留学生论坛

本站QQ群:前端 618073944 | Java 606181507 | Python 626812652 | C/C++ 612253063 | 微信 634508462 | 苹果 692586424 | C#/.net 182808419 | PHP 305140648 | 运维 608723728

W3xue 的所有内容仅供测试,对任何法律问题及风险不承担任何责任。通过使用本站内容随之而来的风险与本站无关。
关于我们  |  意见建议  |  捐助我们  |  报错有奖  |  广告合作、友情链接(目前9元/月)请联系QQ:27243702 沸活量
皖ICP备17017327号-2 皖公网安备34020702000426号