+ -
当前位置:首页 → 问答吧 → 纯CSS菜单(一)

纯CSS菜单(一)

时间:2008-06-19

来源:互联网

下载 (25.12 KB)
2008-6-19 03:56





  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  2. "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  3. <html xmlns="http://www.w3.org/1999/xhtml">
  4. <head>
  5. <meta http-equiv="Content-Type" content="text/html; charset=gb2312"
  6. />
  7. <title>二级dropdown弹出菜单--A CROSS BROWSER DROP DOWN CASCADING
  8. VALIDATING MENU</title>
  9. <style type="text/css">
  10. /* common styling */
  11. /* set up the overall width of the menu div, the font and the
  12. margins */
  13. .menu {
  14. font-family: arial, sans-serif;
  15. width:750px;
  16. margin:0;
  17. margin:50px 0;
  18. }
  19. /* remove the bullets and set the margin and padding to zero for
  20. the unordered list */
  21. .menu ul {
  22. padding:0;
  23. margin:0;
  24. list-style-type: none;
  25. }
  26. /* float the list so that the items are in a line and their
  27. position relative so that the drop down list will appear in the
  28. right place underneath each list item */
  29. .menu ul li {
  30. float:left;
  31. position:relative;
  32. }
  33. /* style the links to be 104px wide by 30px high with a top and
  34. right border 1px solid white. Set the background color and the font
  35. size. */
  36. .menu ul li a, .menu ul li a:visited {
  37. display:block;
  38. text-align:center;
  39. text-decoration:none;
  40. width:104px;
  41. height:30px;
  42. color:#000;
  43. border:1px solid #fff;
  44. border-width:1px 1px 0 0;
  45. background:#c9c9a7;
  46. line-height:30px;
  47. font-size:11px;
  48. }
  49. /* make the dropdown ul invisible */
  50. .menu ul li ul {
  51. display: none;
  52. }
  53. /* specific to non IE browsers */
  54. /* set the background and foreground color of the main menu li on
  55. hover */
  56. .menu ul li:hover a {
  57. color:#fff;
  58. background:#b3ab79;
  59. }
  60. /* make the sub menu ul visible and position it beneath the main
  61. menu list item */
  62. .menu ul li:hover ul {
  63. display:block;
  64. position:absolute;
  65. top:31px;
  66. left:0;
  67. width:105px;
  68. }
  69. /* style the background and foreground color of the submenu links
  70. */
  71. .menu ul li:hover ul li a {
  72. display:block;
  73. background:#faeec7;
  74. color:#000;
  75. }
  76. /* style the background and forground colors of the links on hover
  77. */
  78. .menu ul li:hover ul li a:hover {
  79. background:#dfc184;
  80. color:#000;
  81. }
  82. </style>
  83. <!--[if lte IE 6]>
  84. <style type="text/css">
  85. /* styling specific to Internet Explorer IE5.5 and IE6. Yet to see
  86. if IE7 handles li:hover */
  87. /* Get rid of any default table style */
  88. table {
  89. border-collapse:collapse;
  90. margin:0;
  91. padding:0;
  92. }
  93. /* ignore the link used by 'other browsers' */
  94. .menu ul li a.hide, .menu ul li a:visited.hide {
  95. display:none;
  96. }
  97. /* set the background and foreground color of the main menu link on
  98. hover */
  99. .menu ul li a:hover {
  100. color:#fff;
  101. background:#b3ab79;
  102. }
  103. /* make the sub menu ul visible and position it beneath the main
  104. menu list item */
  105. .menu ul li a:hover ul {
  106. display:block;
  107. position:absolute;
  108. top:32px;
  109. left:0;
  110. width:105px;
  111. }
  112. /* style the background and foreground color of the submenu links
  113. */
  114. .menu ul li a:hover ul li a {
  115. background:#faeec7;
  116. color:#000;
  117. }
  118. /* style the background and forground colors of the links on hover
  119. */
  120. .menu ul li a:hover ul li a:hover {
  121. background:#dfc184;
  122. color:#000;
  123. }
  124. </style>
  125. <![endif]-->
  126. </head>
  127. <body>
  128. <div class="menu">
  129. <ul>
  130. <li><a class="hide" href="../menu/index.html">DEMOS</a>
  131. <!--[if lte IE 6]>
  132. <a href="../menu/index.html">DEMOS
  133. <table><tr><td>
  134. <![endif]-->
  135.     <ul>
  136.     <li><a href="../menu/zero_dollars.html" title="The zero dollar
  137. ads page">zero dollars</a></li>
  138.     <li><a href="../menu/embed.html" title="Wrapping text around
  139. images">wrapping text</a></li>
  140.     <li><a href="../menu/form.html" title="Styling forms">styled
  141. form</a></li>
  142.     <li><a href="../menu/nodots.html" title="Removing active/focus
  143. borders">active focus</a></li>
  144.     <li><a href="../menu/shadow_boxing.html" title="Multi-position
  145. drop shadow">shadow boxing</a></li>
  146.     <li><a href="../menu/old_master.html" title="Image Map for
  147. detailed information">image map</a></li>
  148.     <li><a href="../menu/bodies.html" title="fun with background
  149. images">fun backgrounds</a></li>
  150.     <li><a href="../menu/fade_scroll.html" title="fade-out
  151. scrolling">fade scrolling</a></li>
  152.     <li><a href="../menu/em_images.html" title="em size images
  153. compared">em sized images</a></li>
  154.     </ul>
  155. <!--[if lte IE 6]>
  156. </td></tr></table>
  157. </a>
  158. <![endif]-->
  159. </li>
  160. <li><a class="hide" href="index.html">MENUS</a>
  161. <!--[if lte IE 6]>
  162. <a href="index.html">MENUS
  163. <table><tr><td>
  164. <![endif]-->
  165.     <ul>
  166.     <li><a href="spies.html" title="a coded list of spies">spies
  167. menu</a></li>
  168.     <li><a href="vertical.html" title="a horizontal vertical
  169. menu">vertical menu</a></li>
  170.     <li><a href="expand.html" title="an enlarging unordered
  171. list">enlarging list</a></li>
  172.     <li><a href="enlarge.html" title="an unordered list with link
  173. images">link images</a></li>
  174.     <li><a href="cross.html" title="non-rectangular links">non-
  175. rectangular</a></li>
  176.     <li><a href="jigsaw.html" title="jigsaw links">jigsaw
  177. links</a></li>
  178.     <li><a href="circles.html" title="circular links">circular
  179. links</a></li>
  180.     </ul>
  181. <!--[if lte IE 6]>
  182. </td></tr></table>
  183. </a>
  184. <![endif]-->
  185. </li>
  186. <li><a class="hide" href="../layouts/index.html">LAYOUTS</a>
  187. <!--[if lte IE 6]>
  188. <a href="../layouts/index.html">LAYOUTS
  189. <table><tr><td>
  190. <![endif]-->
  191.     <ul>
  192.     <li><a href="../layouts/bodyfix.html" title="Cross browser
  193. fixed layout">Fixed 1</a></li>
  194.     <li><a href="../layouts/body2.html" title="Cross browser fixed
  195. layout">Fixed 2</a></li>
  196.     <li><a href="../layouts/body4.html" title="Cross browser fixed
  197. layout">Fixed 3</a></li>
  198.     <li><a href="../layouts/body5.html" title="Cross browser fixed
  199. layout">Fixed 4</a></li>
  200.     <li><a href="../layouts/minimum.html" title="A simple minimum
  201. width layout">minimum width</a></li>
  202.     </ul>
  203. <!--[if lte IE 6]>
  204. </td></tr></table>
  205. </a>
  206. <![endif]-->
  207. </li>
  208. <li><a class="hide" href="../boxes/index.html">BOXES</a>
  209. <!--[if lte IE 6]>
  210. <a href="../boxes/index.html">BOXES
  211. <table><tr><td>
  212. <![endif]-->
  213.     <ul>
  214.     <li><a href="spies.html" title="a coded list of spies">spies
  215. menu</a></li>
  216.     <li><a href="vertical.html" title="a horizontal vertical
  217. menu">vertical menu</a></li>
  218.     <li><a href="expand.html" title="an enlarging unordered
  219. list">enlarging list</a></li>
  220.     <li><a href="enlarge.html" title="an unordered list with link
  221. images">link images</a></li>
  222.     <li><a href="cross.html" title="non-rectangular links">non-
  223. rectangular</a></li>
  224.     <li><a href="jigsaw.html" title="jigsaw links">jigsaw
  225. links</a></li>
  226.     <li><a href="circles.html" title="circular links">circular
  227. links</a></li>
  228.     </ul>
  229. <!--[if lte IE 6]>
  230. </td></tr></table>
  231. </a>
  232. <![endif]-->
  233. </li>
  234. <li><a class="hide" href="../mozilla/index.html">MOZILLA</a>
  235. <!--[if lte IE 6]>
  236. <a href="../mozilla/index.html">MOZILLA
  237. <table><tr><td>
  238. <![endif]-->
  239.     <ul>
  240.     <li><a href="../mozilla/dropdown.html" title="A drop down
  241. menu">drop down menu</a></li>
  242.     <li><a href="../mozilla/cascade.html" title="A cascading
  243. menu">cascading menu</a></li>
  244.     <li><a href="../mozilla/content.html" title="Using
  245. content:">content:</a></li>
  246.     <li><a href="../mozilla/moxbox.html" title=":hover applied to a
  247. div">mozzie box</a></li>
  248.     <li><a href="../mozilla/rainbow.html" title="I can build a
  249. rainbow">rainbow box</a></li>
  250.     <li><a href="../mozilla/snooker.html" title="Snooker
  251. cue">snooker cue</a></li>
  252.     <li><a href="../mozilla/target.html" title="Target
  253. Practise">target practise</a></li>
  254.     <li><a href="../mozilla/splittext.html" title="Two tone
  255. headings">two tone headings</a></li>
  256.     <li><a href="../mozilla/shadow_text.html" title="Shadow
  257. text">shadow text</a></li>
  258.     </ul>
  259. <!--[if lte IE 6]>
  260. </td></tr></table>
  261. </a>
  262. <![endif]-->
  263. </li>
  264. <li><a class="hide" href="../ie/index.html">EXPLORER</a>
  265. <!--[if lte IE 6]>
  266. <a href="../ie/index.html">EXPLORER
  267. <table><tr><td>
  268. <![endif]-->
  269.     <ul>
  270.     <li><a href="../ie/exampleone.html" title="Example one">example
  271. one</a></li>
  272.     <li><a href="../ie/weft.html" title="Weft fonts">weft
  273. fonts</a></li>
  274.     <li><a href="../ie/exampletwo.html" title="Vertical
  275. align">vertical align</a></li>
  276.     </ul>
  277. <!--[if lte IE 6]>
  278. </td></tr></table>
  279. </a>
  280. <![endif]-->
  281. </li>
  282. <li><a class="hide" href="../opacity/index.html">OPACITY</a>
  283. <!--[if lte IE 6]>
  284. <a href="../opacity/index.html">OPACITY
  285. <table><tr><td>
  286. <![endif]-->
  287.     <ul>
  288.     <li><a href="../opacity/colours.html" title="colour
  289. wheel">opaque colours</a></li>
  290.     <li><a href="../opacity/picturemenu.html" title="a menu using
  291. opacity">opaque menu</a></li>
  292.     <li><a href="../opacity/png.html" title="partial
  293. opacity">partial opacity</a></li>
  294.     <li><a href="../opacity/png2.html" title="partial opacity
  295. II">partial opacity II</a></li>
  296.     </ul>
  297. <!--[if lte IE 6]>
  298. </td></tr></table>
  299. </a>
  300. <![endif]-->
  301. </li>
  302. </ul>
  303. <!-- clear the floats if required -->
  304. <div class="clear">&nbsp;</div>
  305. </div>
  306. </body>
  307. </html>
复制代码

作者: 0871   发布时间: 2008-06-19

look

作者: ph911   发布时间: 2008-06-22

作者: 风雨人生   发布时间: 2008-06-22

看看

作者: kevin_zhang1983   发布时间: 2008-06-22

真牛!

作者: shenjie117   发布时间: 2008-07-09

谢谢啦~

作者: wanglizhi208   发布时间: 2008-07-09

   谢谢楼主

作者: belial_zm   发布时间: 2008-07-12

谢谢分享

作者: golostyle   发布时间: 2008-07-19

谢谢分享

作者: caihua888   发布时间: 2008-07-19

效果不错,要是做成从数据库读取菜单名称的动态的就更好了,呵呵不知道lz能否搞一个出来

作者: faintok   发布时间: 2008-09-28