һ
 ¼ע

QQ¼

ֻһٿʼ

ƼĶ

+
̳ WEBҳǰ뿪 ǰ̨ű

CSSԶselectѡ(ǩģ)

[]
14452 websjy 2014-4-13 10:41:00
| ʾȫ¥
1F

ȺʵôԶselectѡʽȺչ˼ҵۣտʼһֱǿʹôCSSʵ֣Ĭϵʽǵ⴦öʧܸգĽԪأul,liģ˵ʹһЩֳɵIJ

ʵselectֻCSSDzܽԶʽģȻôã˵һCSSʵֵ˼·ɡ

ȶĬϵʽ


տʼ뵽ʹñselectñЧģǺ뵽˸ǣԪذǸµļͷסȻԪñд˸demoֿУǾЩ

һaǩסselect


  1. <font color="rgb(102, 102, 102)"><a class="btn-select" id="btn_select">
  2.     <select>
  3.         <option>ѡһ</option>
  4.         <option>ѡ</option>
  5.         <option>ѡ</option>
  6.         <option>ѡ</option>
  7.         <option>ѡ</option>
  8.     </select>
  9. </a></font>
ƴ



cssselectءdisplay:none;ȻselectԪزˣǿ԰select͸ȸΪ0ͿˣӰ򣬵ʱ򻹻֣òǿˣǻᷢÿѡѡѡδʾselectصԭˣҲˣҪһıǩÿѡѡHTML룺

  1. <form>
  2. <a class="btn-select" id="btn_select">
  3.     <span class="cur-select">ѡ</span>
  4.     <select>
  5.         <option>ѡһ</option>
  6.         <option>ѡ</option>
  7.         <option>ѡ</option>
  8.         <option>ѡ</option>
  9.         <option>ѡ</option>
  10.     </select>
  11. </a>
  12. </form>
ƴ


CSS룺


  1. <font color="rgb(102, 102, 102)">* {
  2.     margin: 0;
  3.     padding: 0;
  4. }
  5.      
  6. body {
  7.     padding: 50px 50px;
  8. }
  9.      
  10. .btn-select {
  11.     position: relative;
  12.     display: inline-block;
  13.     width: 150px;
  14.     height: 25px;
  15.     background-color: #f80;
  16.     font: 14px/20px "Microsoft YaHei";
  17.     color: #fff;
  18. }
  19.      
  20. .btn-select .cur-select {
  21.     position: absolute;
  22.     display: block;
  23.     width: 150px;
  24.     height: 25px;
  25.     line-height: 25px;
  26.     background: #f80 url(ico-arrow.png) no-repeat 125px center;
  27.     text-indent: 10px;
  28. }
  29.      
  30. .btn-select:hover .cur-select {
  31.     background-color: #f90;
  32. }
  33.      
  34. .btn-select select {
  35.     position: absolute;
  36.     top: 0;
  37.     left: 0;
  38.     width: 150px;
  39.     height: 25px;
  40.     opacity: 0;
  41.     filter: alpha(opacity: 0;);
  42.     font: 14px/20px "Microsoft YaHei";
  43.     color: #f80;
  44. }
  45.      
  46. .btn-select select option {
  47.     text-indent: 10px;
  48. }
  49.      
  50. .btn-select select option:hover {
  51.     background-color: #f80;
  52.     color: #fff;
  53. }</font>
ƴ


Ч(ChromeϵĽͼ)



ȫĬʽͼı߿⣬ieϾ͸ѿˣĿʹõĻòɣԪش档

IJû꣬ҪõһjsҪѡеݷŵspanǩʾjs룺


  1. <font color="rgb(102, 102, 102)">var $ = function (id) {
  2.     return document.getElementById(id);
  3. }
  4. window.onload = function () {
  5.     var btnSelect = $("btn_select");
  6.     var curSelect = btnSelect.getElementsByTagName("span")[0];
  7.     var oSelect = btnSelect.getElementsByTagName("select")[0];
  8.     var aOption = btnSelect.getElementsByTagName("option");
  9.     oSelect.onchange = function () {
  10.         var text=oSelect.options[oSelect.selectedIndex].text;
  11.         curSelect.innerHTML = text;
  12.     }
  13. }</font>
ƴ

okˡdemoԴأ



DEMO




аԴ

Ҫ ¼ ſػ鿴ûʺţ¼ע  

x
Դ΢http://weibo.com/techued Դ΢Źںţweb-tech
ʹõ ٱ ظ
콵·bqd 2014-6-6 17:04:00
| ʾȫ¥
2F
ٶȹٷװ6· 5ֽ뼼Աƹ
ٶǮ|ٶ|ٶǮ עȡ
ٶɱ1Ԫ/װ/̨ٶʿ1Ԫ/װ/̨ٶ1Ԫ1Ԫ/װ/̨ٶ뷨0.1Ԫ/װ/̨Ӱ0.3Ԫ/װ/̨JJϷ5Ԫ/װ
hao123ҳ 60-100Ԫ/1000IP/ս㡣
1.2Ԫpps 1.2ԪٶӰȰٶȹٷƷ½ƹ㡣
㣺ÿ10-15Ž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n/AxTPpq
׿ϵͳעַhttp://url.cn/FfodQc
Դ΢http://weibo.com/techued Դ΢Źںţweb-tech
ʹõ ٱ ظ ֧
б

ֹ

̳¡ͼƬѷϴվԭתԻ,µİȨԭ
վַİȨ֪ͨǵĹԱ,Ա(Email:admin@websjy.com)ʱȡȨɾ
ܾκκʽڱ̳л񹲺͹ִ!

QQ| 42011102000510|Archiver|ֻ|Դ ( ICP14013341-1

GMT+8, 2018-12-11 21:59

Powered by Discuz! X3.2

ԴԴվ  ԴAPPӦ֮

ٻظ ض б