1. 去掉input 在iOS中的默认圆角和内阴影 iOS下 input会有自带的圆角和内阴影,去掉方法如下: [code] input{ -webkit-appearance: none; border-radius: 0; } [/code]2. 焦点在 input 时,placeholder 没有隐藏 [code] input:focus::-webkit-input-placeholder{ opacity: 0; } [/code]3. input 输入框调出数字键盘 单独使用type="number"时,iOS调起的并不是九宫格样式的数字键盘,如果必要调起九宫格的数字键盘必要加上 pattern="[0-9]*" 属性 [code] <!-- 数字键盘 带有符号,非九宫格样式 --> <input type="number"/> <!-- 九宫格数字键盘 --> <input type="number" pattern="[0-9]*"/> <!-- 电话号码键盘 --> <input type="tel"/> [/code]4. 搜索时,键盘的回车按钮笔墨设定为“搜索” 解决: input 使用 type="search",放在 form 表单内。两者结合就能使输入法中的回车按钮笔墨变为“搜索” [code] <form action=""> <input type="search" /> </form>[/code]5. 改变input placeholder颜色 6. iOS下autofocus focus()失效的题目 iOS下不能自动获取焦点,必须是在监听到用户发出的变乱的函数中执行focus才有用,比如: [code] // openNotifyReplay 是click触发的变乱 openNotifyReplay = (e) => { this.setState({ notifyReplayVisible: true }, ()=>{ document.getElementById("replayPopupText").focus() }) } [/code]到此这篇关于移动端HTML5 input常见题目(小结)的文章就介绍到这了,更多相关移动端HTML5 input内容请搜索脚本之家从前的文章或继承浏览下面的相关文章,盼望各人以后多多支持脚本之家! 来源:https://www.jb51.net/html5/747016.html 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |
|手机版|小黑屋|梦想之都-俊月星空
( 粤ICP备18056059号 )|网站地图
GMT+8, 2025-7-2 02:28 , Processed in 0.032035 second(s), 19 queries .
Powered by Mxzdjyxk! X3.5
© 2001-2025 Discuz! Team.