• 美化的select下拉框


    ie7浏览器以后的下拉框,给他加上边框样式,是没用的。要是想做出样式好看的下拉框需要用js或者jquery来模拟实现。

    代码如下:

          1. <div class="r">
          2.                 <dl class="link" id="link">
          3.                     <dt>友情链接</dt>
          4.                     <dd>
          5.                         <ul>
          6.                             <li><a href="###" target="_blank">友情链接一</a>
          7. `<a href="###" target="_blank">友情链接二</a>`</li>                        </ul>
          8.                     </dd>
          9.                 </dl>
          10.             </div>

    css代码:

    1. div.bottomTop div.bottomTopRight dl.link {
    2.     margin-right:0px;
    3.     display:inline-block;
    4.     border:1px solid #484848;
    5.     margin-left:15px;
    6.     font-size:12px;
    7.     margin-top:15px;
    8.     width:90px;
    9.     height:18px;
    10. }
    11. div.bottomTop div.bottomTopRight dl.link dt {
    12.     background:url(../images/select_bg.gif) no-repeat 7px center;
    13.     color:#515151;
    14.     text-indent:18px;
    15.     height:18px;
    16.     line-height:18px;
    17.     width:90px;
    18.     cursor:pointer;
    19.     font-family:宋体;
    20. }
    21. div.bottomTop div.bottomTopRight dl.link dd {
    22.     display:none;
    23.     position:relative;
    24. }
    25. div.bottomTop div.bottomTopRight dl.link ul {
    26.     position:absolute;
    27.     right:0px;
    28.     bottom:19px;
    29.     display:block;
    30.     width:90px;
    31.     background:#999999;
    32. }
    33. div.bottomTop div.bottomTopRight dl.link ul li {
    34.     height:22px;
    35.     line-height:22px;
    36.     text-align:left;
    37.     text-indent:18px;
    38. }
    39. div.bottomTop div.bottomTopRight dl.link ul li a {
    40.     color:#515151;
    41.     font-family:宋体;
    42. }
        1. jquery代码:
              • <script type="text/javascript">
              • $(function(){
              •     $('#link dt').click(function(){
              •         $('#link dd').toggle();
              •     });
              • })
              • </script>
          
          
          
          1. 要注意一点的是,要实现这个效果,<dd></dd>千万别加高度,
  • 相关阅读:
    Yii隐藏单入口
    JS字符串的问题
    暑假第三测
    暑假第二测
    暑假第一测
    沈阳集训day4
    沈阳集训day3
    P2571 [SCOI2010]传送带
    CF626C Block Towers
    洛谷P4171 [JSOI2010]满汉全席
  • 原文地址:https://www.cnblogs.com/jsingleegg/p/5010598.html
Copyright © 2020-2023  润新知