CSS打造经典鼠标触发显示选项

使用CSS打造鼠标触发效果
本文介绍了如何利用CSS实现鼠标触发效果,包括样式定义、事件监听及交互元素的响应方式,详细展示了通过CSS来增强用户体验的方法。


  1. <!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <htmlxmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <metahttp-equiv="Content-Type"content="text/html;charset=utf-8"/>
  5. <metahttp-equiv="Content-Language"content="zh-CN"/>
  6. <title>css打造鼠标触发效果</title>
  7. <styletype="text/css">
  8. <!--
  9. body{
  10. margin:0;
  11. padding:0;
  12. color:#000;
  13. font-size:12px;
  14. line-height:160%;
  15. text-align:left;
  16. height:100%;
  17. font-family:'宋体',Tahoma,arial,verdana,sans-serif,'LucidaGrande','LucidaSansUnicode';
  18. }
  19. *{margin:0;padding:0;}
  20. h2,h2a:link,h2a:hover,h2a:visited{
  21. font-size:14px;
  22. text-decoration:none;
  23. color:#000000;
  24. }
  25. .kw_from{
  26. padding:20px000px;
  27. margin:auto;
  28. height:300px;
  29. overflow:hidden;
  30. width:650px;
  31. }
  32. .kw_from.sbtn{
  33. float:left;
  34. width:80px;
  35. padding:16px000;
  36. }
  37. .kw_from.searchMore{
  38. float:left;
  39. width:80px;
  40. padding:4px;
  41. }
  42. #searchNav{
  43. width:430px;
  44. float:left;
  45. }
  46. #searchNav#conter1,#searchNav#conter3{
  47. float:left;
  48. width:250px;
  49. }
  50. #searchNav#conter2,#searchNav#conter4{
  51. float:left;
  52. width:180px;
  53. }
  54. #searchNavul{
  55. padding:0;
  56. margin:0;
  57. list-style:none;
  58. }
  59. #searchNavli{
  60. float:left;
  61. }
  62. #searchNavliul{
  63. display:none;
  64. top:20px;
  65. }
  66. #searchNavli:hoverul,#searchNavli.overul{
  67. display:block;
  68. float:left;
  69. }
  70. #searchNavullia{
  71. float:left;
  72. display:block;
  73. font-size:12px;
  74. padding:3px;
  75. text-decoration:none;
  76. color:#777;
  77. }
  78. #searchNavullia:hover{
  79. background-color:#f4f4f4;
  80. }
  81. #searchNav#jobKw{
  82. width:220px;
  83. height:18px;
  84. }
  85. #searchNav#cityKw{
  86. width:130px;
  87. height:18px;
  88. }
  89. -->
  90. </style>
  91. <scripttype="text/javascript">
  92. <!--//--><![CDATA[//>
  93. <!--
  94. startList=function(){
  95. if(document.all&&document.getElementById){
  96. navRoot=document.getElementById("searchNav");
  97. for(i=0;i<navRoot.childNodes.length;i++){
  98. node=navRoot.childNodes[i];
  99. if(node.nodeName=="LI"){
  100. node.onmouseover=function(){
  101. this.className+="over";
  102. }
  103. node.onmouseout=function(){
  104. this.className=this.className.replace("over","");
  105. }
  106. }
  107. }
  108. }
  109. }
  110. window.onload=startList;
  111. //--><!]]>
  112. </script>
  113. </head>
  114. <body>
  115. <divclass="kw_from">
  116. <formaction="/search.html"method="get"name="searchForm"id="searchForm"onsubmit="returncheck()">
  117. <ulid="searchNav">
  118. <liid="conter1"><h2>找什么</h2>
  119. <inputid="jobKw"name="jobKw"type="text"/>
  120. <ulid="conter3">
  121. <li><ahref="#">会计</a></li>
  122. <li><ahref="#">网页设计</a></li>
  123. <li><ahref="#">翻译</a></li>
  124. <li><ahref="#">家教</a></li>
  125. <li><spanclass="moreCity"><ahref="#">更多>></a></span></li>
  126. </ul>
  127. </li>
  128. <liid="conter2"><h2>在那里</h2>
  129. <inputid="cityKw"name="cityKw"type="text"/>
  130. <ulid="conter4">
  131. <li><ahref="#">北京</a></li>
  132. <li><ahref="#">上海</a></li>
  133. <li><ahref="#">广州</a></li>
  134. <li><ahref="#">深圳</a></li>
  135. <li><ahref="#">南京</a></li>
  136. <li><ahref="#">天津</a></li>
  137. <li><ahref="#">杭州</a></li>
  138. <li><ahref="#">成都</a></li>
  139. <li><ahref="#">重庆</a></li>
  140. <li><ahref="#">武汉</a></li>
  141. <li><ahref="#">西安</a></li>
  142. <li><ahref="#">沈阳</a></li>
  143. <li><spanclass="moreCity"><ahref="#">更多城市>></a></span></li>
  144. </ul>
  145. </li>
  146. </ul>
  147. <divclass="sbtn">
  148. <inputname="submit"type="submit"class="btn4"style="margin:0px15px2px0;"value="搜索工作"/>
  149. </div>
  150. <divclass="searchMore">
  151. <ahref="search_expert.html">高级搜索</a><br/><ahref="search_sort.html">分类搜索</a></div>
  152. </form>
  153. </div>
  154. </body>
  155. </html>

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值