css使用背景图片制作搜索框

  1. <!DOCTYPE html>  
  2. <html>  
  3. <head>  
  4. <meta charset="utf-8">  
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">  
  6. <title>使用图片制作搜索框</title>  
  7. <meta name="description" content="">  
  8. <meta name="keywords" content="">  
  9. <link href="" rel="stylesheet">  
  10. <style>  
  11.     .searchCon {  
  12.         width: 330px;  
  13.         height: 35px;  
  14.         background: url(images/search.jpg) no-repeat;  
  15.         position: relative;  
  16.     }  
  17.   
  18.     .searchCon input.inputText{  
  19.         width: 235px;  
  20.         height: 24px;  
  21.         line-height: 24px;  
  22.         position: absolute;  
  23.         top: 4px;  
  24.         left: 5px;  
  25.         border: 0;  
  26.         border: none;  
  27.         background: none;  
  28.     }  
  29.     .searchCon input.inputButton {  
  30.         width: 73px;  
  31.         height: 33px;  
  32.         position: absolute;  
  33.         left: 257px;  
  34.         top: 1px;  
  35.         cursor: hand;  
  36.         cursor: pointer;  
  37.         /* filter: alpha(opacity: 0);  
  38.         opacity: 0;  */  
  39.         border: 0;      /*隐藏默认属性*/  
  40.         background: none;   /*隐藏默认属性*/  
  41.     }  
  42. </head>  
  43. <body>  
  44.     <div class="searchCon">  
  45.         <input type="text" class="inputText">  
  46.         <input type="button" class="inputButton">  
  47.     </div>  
  48.     <!--使用背景图片的搜索框思路  
  49.       使背景图片中的输入框和搜索按钮与实际输入框和搜索按钮的位置重合,在完成输入框和搜索按钮的尺寸、文本的调整后,使得一切边框皆为0、一切挡住背景图片的元素均为透明即可。  
  50.   -->    
  51. </body>  
  52. </html>  
  53. 版权声明:此内容转载自: https://blog.csdn.net/wuzhe128520/article/details/50112375
  • 0
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值