input的一些用法

input的一些用法

  1. 怎样使input的光标隐藏
    color:transparent;
    text-shadow:0 0 0 #303030;——改变字体

  2. 怎样使input获取/失去焦点
    js — onfocus/onblur
    jquery — focus()/blur()

  3. 改变下拉框的箭头样式

select {
            /*Chrome和Firefox里面的边框是不一样的,所以复写了一下*/
            border: solid 1px #000;
            /*很关键:将默认的select选择框样式清除*/
            appearance:none;
            -moz-appearance:none;
            -webkit-appearance:none;
            /*在选择框的最右侧中间显示小箭头图片*/
            background: url("../img/drop-down.png") no-repeat scroll right center transparent;
            /*为下拉小箭头留出一点位置,避免被文字覆盖*/
            padding-right: 14px;
        }
  1. 改变radio的样式
input[type=radio]{
    font-size:1em;
    visibility: hidden;
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
}
input[type=radio]:before{
    font-size:1em;
    top:12%;
    display: inline-block;
    position: absolute;
    content:' ';
    visibility: visible;
    height: 1em;
    width: 1em;
    display: block;
    background: url("../img/checkbox_no.png") no-repeat;background-size: 1em 1em;
}
input[type=radio]:checked:before{
    content:' ';
    visibility: visible;
    height: 1em;
    width: 1em;
    background: url("../img/yes.png") no-repeat;background-size: 1em 1em;
}

5.改变checkbox样式

input[type=checkbox]{
    font-size:1em;
    visibility: hidden;
    cursor: pointer;
    position: relative;
    display: inline-block;
    width: 1em;
    height: 1em;
}
input[type=checkbox]:before{
    top:12%;
    display: inline-block;
    position: absolute;
    content:' ';
    visibility: visible;
    height: 1em;
    width: 1em;
    display: block;
    background: url("../../img/checkbox_no.png") no-repeat;background-size: 1em 1em;
}
input[type=checkbox]:checked:before{
    content:' ';
    visibility: visible;
    height: 1em;
    width: 1em;
    background: url("../../img/checkbox.png") no-repeat;
    background-size: 1em 1em;
}
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值