移动端重构系列3——重置样式
2015-09-30 14:08
471 查看
移动端重构系列-mobile
本系列文章,如果没有特别说明,兼容安卓4.0.4+,测试demo基于Normalize.css,根据目前我们大家的使用习惯进行了一些清零及移动端的特点添加一些基础样式。
html { font-family: "Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif; -ms-text-size-adjust: 100%; -webkit-text-size-adjust: 100%; font-size: 62.5%; } body { margin: 0; font-size: 1.4rem; line-height: 1.5; color: #333333; background-color: white; height: 100%; overflow-x: hidden; -webkit-overflow-scrolling: touch; } article, aside, details, figcaption, figure, footer, header, hgroup, main, nav, section, summary { display: block; } audio, canvas, progress, video { display: inline-block; vertical-align: baseline; } audio:not([controls]) { display: none; height: 0; } [hidden], template { display: none; } svg:not(:root) { overflow: hidden; } a { background: transparent; text-decoration: none; -webkit-tap-highlight-color: transparent; color: #0088cc; } a:active { outline: 0; } a:active { color: #006699; } abbr[title] { border-bottom: 1px dotted; } b, strong { font-weight: bold; } dfn { font-style: italic; } mark { background: #ff0; color: #000; } small { font-size: 80%; } sub, sup { font-size: 75%; line-height: 0; position: relative; vertical-align: baseline; } sup { top: -0.5em; } sub { bottom: -0.25em; } img { border: 0; vertical-align: middle; } hr { -moz-box-sizing: content-box;box-sizing: content-box;height:0;}pre { overflow: auto;white-space: pre;white-space: pre-wrap;word-wrap: break-word;}code, kbd, pre, samp { font-family: monospace, monospace;font-size:1em;}button, input, optgroup, select, textarea { color: inherit;font: inherit;margin:0;}button { overflow: visible;}button, select { text-transform: none;}button, html input[type="button"], input[type="reset"], input[type="submit"] { -webkit-appearance: button;cursor: pointer;}button[disabled], html input[disabled] { cursor: default;}button::-moz-focus-inner, input::-moz-focus-inner { border:0;padding:0;}input { line-height: normal;}input[type="checkbox"], input[type="radio"] { box-sizing: border-box;padding:0;}input[type="number"]::-webkit-inner-spin-button, input[type="number"]::-webkit-outer-spin-button { height: auto;}input[type="search"] { -webkit-appearance: textfield;-moz-box-sizing: border-box;-webkit-box-sizing: border-box;box-sizing: border-box;}input[type="search"]::-webkit-search-cancel-button, input[type="search"]::-webkit-search-decoration { -webkit-appearance: none;}fieldset { border:1px solid #c0c0c0;margin:0 2px;padding:0.35em 0.625em 0.75em;}legend { border:0;padding:0;}textarea { overflow: auto;resize: vertical;}optgroup { font-weight: bold;}table { border-collapse: collapse;border-spacing:0;}td, th { padding:0;}html, button, input, select, textarea { font-family:"Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif;}h1, h2, h3, h4, h5, h6, p, figure, form, blockquote { margin:0;}ul, ol, li, dl, dd { margin:0;padding:0;}ul, ol { list-style: none outside none;}h1, h2, h3 { line-height:2;font-weight: normal;}h1 { font-size:1.8rem;}h2 { font-size:1.6rem;}h3 { font-size:1.4rem;}input::-moz-placeholder, textarea::-moz-placeholder { color:#cccccc;}input:-ms-input-placeholder, textarea:-ms-input-placeholder { color:#cccccc;}input::-webkit-input-placeholder, textarea::-webkit-input-placeholder { color:#cccccc;} * { -webkit-box-sizing: border-box;-moz-box-sizing: border-box;box-sizing: border-box;}
具体说明请参考sandal中的reset文件
这里有两点需要说明:
1、关于moz前缀
因为本人习惯使用firefox浏览器,所以没有舍弃moz前缀,而且moz前缀也不多,就几个而已,所以没有去掉。如有代码洁癖者,可去掉。
2、关于字体
font-family: "Helvetica Neue", Helvetica, STHeiTi, Arial, sans-serif;
IOS
iOS 4.0+ 使用英文字体 Helvetica Neue,之前的iOS版本降级使用 Helvetica,中文字体设置为华文黑体STHeiTi。
Android
原生Android下中文字体与英文字体都选择默认的无衬线字体,4.0之前版本英文字体原生Android使用的是Droid Sans,中文字体原生Android会命中Droid Sans Fallback,4.0+ 中英文字体都会使用原生Android新的Roboto字体。其他第三方Android系统也一致选择默认的无衬线字体。
最后加上Arial字体方便pc端查看效果。
参考资料:字体设置
如需转载,烦请注明出处:/article/1214289.html
相关文章推荐
- android-----ListView和GridView的用法
- iOS 使用TableView实现下拉放大
- 【手机端】iPhone、iPad上Safari浏览器的橡皮筋效果阻止
- iOS AutoLayout 及SizeClass 自动布局(一)
- AndroidStudio快捷键
- android:scrollbarStyle属性
- iOS 8 自动布局sizeclass和autolayout的使用
- Android Studio 中ADB WIFI 插件的使用
- Android Studio安装后提示No JVM installation found解决办法
- IOS 开源库总结
- Unity将来时:IL2CPP是什么?
- android 5.1 中添加显示运营商的控制
- iOS webview缩小页面内容
- android 页面停几秒后跳转
- Android(java方法)上实现mp4的分割和拼接 (一)
- App如何选择移动广告平台,开发者2 - 移动变现模式分析
- 移动端重构系列2——整体布局(转载)
- 微信刀下多亡魂,这些封杀你都知道吗?
- android Fragment真正的完全解析(下)
- Android Fragment的完全解析(上)