【生意多】-免费发布分类信息
当前位置: 首页 » 新闻 » 教程 » 操作系统 » 正文

移动网络提示端到端不正常(移动疑难问题)

放大字体  缩小字体 发布日期:2022-07-02 17:19:42    浏览次数:15

1. 去掉input 在iOS中的默认圆角和内阴影

iOS下 input会有自带的圆角和内阴影,去掉方法如下:

?
1
2
3
4
input{
    -webkit-appearance: none;
    border-radius: 0;
}

area>input{ -webkit-appearance: none; border-radius: 0;}area>

2. 焦点在 input 时,placeholder 没有隐藏

?
1
2
3
input:focus::-webkit-input-placeholder{
    opacity: 0;
}

area>input:focus::-webkit-input-placeholder{ opacity: 0;}area>

3. input 输入框调出数字键盘

单独使用type="number"时,iOS调起的并不是九宫格样式的数字键盘,如果需要调起九宫格的数字键盘需要加上 pattern="[0-9]*" 属性

?
1
2
3
4
5
6
7
8
<!-- 数字键盘 带有符号,非九宫格样式 -->
<input type="number"/>
 
<!-- 九宫格数字键盘 -->
<input type="number" pattern="[0-9]*"/>
 
<!-- 电话号码键盘 -->
<input type="tel"/>

area><!-- 数字键盘 带有符号,非九宫格样式 --><input type="number"/><!-- 九宫格数字键盘 --><input type="number" pattern="[0-9]*"/><!-- 电话号码键盘 --><input type="tel"/>area>

4. 搜索时,键盘的回车按钮文字设定为“搜索”

解决: input 使用 type="search",放在 form 表单内。两者结合就能使输入法中的回车按钮文字变为“搜索”

?
1
2
3
<form action="">
    <input type="search" />
</form>

area><form action=""> <input type="search" /></form>area>

5. 改变input placeholder颜色

?
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
::-webkit-input-placeholder {
  color:    #999;
}
:-moz-placeholder {
  color:    #999;
  opacity:  1;
}
::-moz-placeholder {
  color:    #999;
  opacity:  1;
}
:-ms-input-placeholder {
  color:    #999;
}
 
input::-webkit-input-placeholder, textarea::-webkit-input-placeholder {  
    color:    #666; 
} 
input:-moz-placeholder, textarea:-moz-placeholder {  
    color:    #666; 
} 
input::-moz-placeholder, textarea::-moz-placeholder {  
    color:    #666; 
} 
input:-ms-input-placeholder, textarea:-ms-input-placeholder {  
    color:    #666; 
}

area>::-webkit-input-placeholder { color: #999;}:-moz-placeholder { color: #999; opacity: 1;}::-moz-placeholder { color: #999; opacity: 1;}:-ms-input-placeholder { color: #999;}input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color: #666; } input:-moz-placeholder, textarea:-moz-placeholder { color: #666; } input::-moz-placeholder, textarea::-moz-placeholder { color: #666; } input:-ms-input-placeholder, textarea:-ms-input-placeholder { color: #666; } area>

6. iOS下autofocus focus()失效的问题

iOS下不能自动获取焦点,必须是在监听到用户发出的事件的函数中执行focus才有用,比如:

?
1
2
3
4
5
6
7
8
// openNotifyReplay 是click触发的事件
openNotifyReplay = (e) => {
    this.setState({
        notifyReplayVisible: true
    }, ()=>{
        document.getElementById("replayPopupText").focus()
    })
}

area>// openNotifyReplay 是click触发的事件openNotifyReplay = (e) => { this.setState({ notifyReplayVisible: true }, ()=>{ document.getElementById("replayPopupText").focus() })}area>

到此这篇关于移动端HTML5 input常见问题(小结)的文章就介绍到这了,更多相关移动端HTML5 input内容请搜索脚本之家以前的文章或继续浏览下面的相关文章,

 
(文/小编)
打赏
免责声明
• 
本文为小编原创作品,作者: 小编。欢迎转载,转载请注明原文出处:https://www.31duo.com/news/show-3609930.html 。本文仅代表作者个人观点,本站未对其内容进行核实,请读者仅做参考,如若文中涉及有违公德、触犯法律的内容,一经发现,立即删除,作者需自行承担相应责任。涉及到版权或其他问题,请及时联系我们。
 

(c)2016-2019 31DUO.COM All Rights Reserved浙ICP备19001410号-4

浙ICP备19001410号-4