1.

<input id="mobile" maxlength="11>

2. input type 为 number 时,maxlength 失效

<input type="number" id="mobile" oninput="if(value.length>11)value=value.slice(0,11)">

reset 默认样式

input[type=color], input[type=date], input[type=datetime-local], input[type=datetime], input[type=email], input[type=month], input[type=number], input[type=password], input[type=search], input[type=tel], input[type=text], input[type=time], input[type=url], input[type=week], select, textarea {
border: 0 none;
outline:none;
background: none;
-webkit-appearance: none;
-webkit-tap-highlight-color: rgba(0, 0, 0, 0);
box-sizing: border-box;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
}

input 设置长度限制 去除默认样式的更多相关文章

  1. meta设置与去除默认样式--移动端开发整理笔记(一)

    视口设置: <meta name="viewport" content="width=device-width,user-scalable=no,initial-s ...

  2. 响应式移动端去除css的hover和jq的hover还有input在苹果下的默认样式

    去除css的hover: /*直接给body添加ontouchstart*/ <body ontouchstart> 去除jq的hover: var winW01 = $(window). ...

  3. 如何更改 iOS 和安卓浏览器上的 input[type="radio"] 元素的默认样式?

    Safari 上的默认样式是这样的, 背景颜色可以使用background-color改变,但中间那个点始终无法去掉. 我查了一些jQuery插件,如iCheck.js,但是那说明写得我都看不明白,根 ...

  4. 去除input获取光标时的默认样式

    给input加上样式   outline:none;

  5. 【input】标签去除默认样式

    input{-webkit-appearance: none; -moz-appearance: none; -o-appearance: none; appearance: none;}

  6. input复选框checkbox默认样式纯css修改

    修改之前的样式  修改之后的样式 html <input type="checkbox" name="btn" id="btn1"&g ...

  7. Css:常用的去除默认样式

    *{   padding: 0;   margin: 0; } ul,ol{   list-style: none; } a,a:hover,a:link,a:visited,a:active{    ...

  8. 去掉或者修改 input、select 等表单的【默认样式 】

    隐藏input等表单的默认样式的背景: textarea,select,input{-webkit-appearance: none; -moz-appearance: none; -o-appear ...

  9. CSS去除Chrome浏览器的控件默认样式

    html的input输入框在Chrome浏览器里是有默认样式的,当它获得焦点时,即使你没有为它设置:focus时的样式,Chrome浏览器还是会给它加上蓝色的边框,今天百度找到有个方法可以去除该默认样 ...

随机推荐

  1. LC 202. Happy Number

    问题描述 Write an algorithm to determine if a number is "happy". A happy number is a number de ...

  2. linux 安装apache

    APR and APR-Util包 下载地址:http://apr.apache.org PCRE 下载地址:http://www.pcre.org Apache Server2.4 下载地址:htt ...

  3. Python 变量作用域与函数

    Python 的创始人为吉多·范罗苏姆(Guido van Rossum).1989年的圣诞节期间,吉多·范罗苏姆为了在阿姆斯特丹打发时间,决心开发一个新的脚本解释程序,作为ABC语言的一种继承.Py ...

  4. JS 验证字符串是否能转为json格式

    var isJSON=function (str) { if (typeof str == 'string') { try { var obj = JSON.parse(str); if (typeo ...

  5. nexus 绑定负载均衡nginx反向代理后 遇到的https问题。

    1.今天搭建maven私服,下载安装好nexus运行后,通过IP可以直接访问,没有问题,如:http://123.123.123.123:8081 就可以进入主页面.没有任何问题. 2.但是他默认是h ...

  6. python 利用pyttsx3文字转语音(转)

    原文链接作者 # -*- coding: utf-8 -*- import pyttsx3 engine = pyttsx3.init() with open("all.txt", ...

  7. github 提交和更新代码

    …or create a new repository on the command line   echo "# flutterPluginsWorks" >> RE ...

  8. ssh: Bad configuration option: usedns

    某天突然听到同事说服务器上git用不了了,上去一看,确实用不了了,git pull报出了如下错误: $ git pull /etc/: Bad configuration option: usedns ...

  9. PCQQ - 发送自定义的XML卡片消息

    效果: 原理: qq分享产生的xml卡片消息存储在qq内存中,可以在qq运行内存中搜索找到其xml源码,记录源码相应的内存地址,通过内存地址修改掉内存数据,再次转发这条分享的消息就会发现内容的变化. ...

  10. 使用Fiddler工具在夜神模拟器或手机上抓包

    下载安装Fiddler 地址:https://www.telerik.com/download/fiddler-everywhere Fiddler端设置 Tools>Options>Co ...