{"action":"created","issue":{"url":"https://api.github.com/repos/yisibl/blog/issues/3","repository_url":"https://api.github.com/repos/yisibl/blog","labels_url":"https://api.github.com/repos/yisibl/blog/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/yisibl/blog/issues/3/comments","events_url":"https://api.github.com/repos/yisibl/blog/issues/3/events","html_url":"https://github.com/yisibl/blog/issues/3","id":29625992,"number":3,"title":"为移动而生的 HTML 属性","user":{"login":"yisibl","id":2784308,"avatar_url":"https://avatars.githubusercontent.com/u/2784308?v=3","gravatar_id":"","url":"https://api.github.com/users/yisibl","html_url":"https://github.com/yisibl","followers_url":"https://api.github.com/users/yisibl/followers","following_url":"https://api.github.com/users/yisibl/following{/other_user}","gists_url":"https://api.github.com/users/yisibl/gists{/gist_id}","starred_url":"https://api.github.com/users/yisibl/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/yisibl/subscriptions","organizations_url":"https://api.github.com/users/yisibl/orgs","repos_url":"https://api.github.com/users/yisibl/repos","events_url":"https://api.github.com/users/yisibl/events{/privacy}","received_events_url":"https://api.github.com/users/yisibl/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":11,"created_at":"2014-03-18T08:01:08Z","updated_at":"2016-03-27T08:40:11Z","closed_at":null,"body":"## iOS\r\n\r\n### 首字母自动大写```autocapitalize ```\r\n\r\n在 iOS 中，用户可以手动开启「首字母自动大写」功能，这样输入英文的时候，首字母便会自动大写。但是，有些时候并不希望一直是首字母大写的。比如用户名这个字段，如果字段本身就是区分大小写的，首字母自动大写往往会给用户带来麻烦。可以通过在表单元素上可以通过设置```autocapitalize=\"off\" ```来关闭。\r\n\r\n```html\r\n<input type=\"text\" autocapitalize=\"off\" placeholder=\"用户名-关闭首字母大写\">\r\n```\r\n\r\n![iOS Setting](http://gtms02.alicdn.com/tps/i2/T1fhV_FtFjXXcW7FMs-640-590.png)\r\n在**设置→通用→键盘**中开启「首字母自动大写」   \r\n\r\n![iOS6/7/7.1](http://www.imore.com/sites/imore.com/files/styles/xlarge/public/field/image/2014/03/ios_71_shift_key_states_screen_0.jpg?itok=wUbG3m51)\r\n  \r\n\r\n\r\n\r\n\r\n还可以在```form```元素上设置该属性，让里面的每个元素都继承```autocapitalize```的设置。\r\n\r\n```html\r\n<form autocapitalize=\"off\">\r\n  <input type=\"text\"  placeholder=\"继承 form 的设置\">\r\n  <textarea></textarea>\r\n</form>\r\n```\r\n\r\niOS 5 开始新增了很多关键字：\r\n\r\n* ```none```等同于```off```。\r\n* 当设置了```autocapitalize=\"words\" ```时，每个单词的开头字母会自动大写。\r\n* 当设置了```autocapitalize=\"characters\"``` 时，每个字母都会大写。\r\n* 当设置了```autocapitalize=\"sentences\"``` 时，每句开头字母会自动大写。\r\n\r\n这里有一个综合示例\r\n```html\r\n<form autocapitalize=\"words\">\r\n    名字: <input name=\"first-name\">\r\n    姓氏: <input name=\"last-name\">\r\n    国家: <input name=\"state\" autocapitalize=\"characters\">\r\n    昵称: <input name=\"username\" autocapitalize=\"off\">\r\n    评论: <textarea name=\"comment\" autocapitalize=\"sentences\"></textarea>\r\n</form>\r\n```\r\n需要注意几点：\r\n\r\n1. ```<input type=\"password\" >```始终不会开启自动首字母大写。\r\n2. 如果在设置中没有开启「首字母大写」，即使设定```autocapitalize=\"on\" ```也不会有作用。\r\n3. 如果「自动改正」和「首字母大写」都启用了，那么提示的字母也是首字母大写的。\r\n4. 越狱后安装的中文输入法里自带的英文输入模式**可能**会不支持「首字母自动大写」功能。\r\n5. 在删除后，再次输入依然是大写的，这一点体验比黑莓好。\r\n6. 在 iOS7.1 中，键盘「shift」按钮的状态做了一些调整：  \r\n    ![iOS7.1 Shift](http://gtms04.alicdn.com/tps/i4/T10INYFqJrXXb2oj.z-536-430.png)\r\n\r\n[**详见：Demo**](http://jsbin.com/norilufa/1/)\r\n[**官方文档**](https://developer.apple.com/library/safari/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/Attributes.html)\r\n### 自动改正 ```autocorrect```\r\n\r\n这是一个布尔属性，可以设置```off```来关闭，同样可以设置在```form```元素上\r\n\r\n```html\r\n<input type=\"text\" autocorrect=\"off\" placeholder=\"用户名-关闭自动改正\">\r\n```\r\n## Android\r\n\r\n================\r\n\r\n未完待续\\(^o^)/~\r\n"},"comment":{"url":"https://api.github.com/repos/yisibl/blog/issues/comments/202015975","html_url":"https://github.com/yisibl/blog/issues/3#issuecomment-202015975","issue_url":"https://api.github.com/repos/yisibl/blog/issues/3","id":202015975,"user":{"login":"Wangbaogang","id":12872699,"avatar_url":"https://avatars.githubusercontent.com/u/12872699?v=3","gravatar_id":"","url":"https://api.github.com/users/Wangbaogang","html_url":"https://github.com/Wangbaogang","followers_url":"https://api.github.com/users/Wangbaogang/followers","following_url":"https://api.github.com/users/Wangbaogang/following{/other_user}","gists_url":"https://api.github.com/users/Wangbaogang/gists{/gist_id}","starred_url":"https://api.github.com/users/Wangbaogang/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Wangbaogang/subscriptions","organizations_url":"https://api.github.com/users/Wangbaogang/orgs","repos_url":"https://api.github.com/users/Wangbaogang/repos","events_url":"https://api.github.com/users/Wangbaogang/events{/privacy}","received_events_url":"https://api.github.com/users/Wangbaogang/received_events","type":"User","site_admin":false},"created_at":"2016-03-27T08:40:11Z","updated_at":"2016-03-27T08:40:11Z","body":"学习\r\n"}}