当前位置 : 主页 > 手机开发 > 无线 >

移动CSS最佳实践

来源:互联网 收集:自由互联 发布时间:2021-06-10
我应该在移动网络中覆盖/重置哪些样式?当你设置margin:0时,是否有类似于桌面web的模式?填充:0;什么元素从一开始?如果我重置太多样式/元素会有什么后果吗? 如果你真的想要重置
我应该在移动网络中覆盖/重置哪些样式?当你设置margin:0时,是否有类似于桌面web的模式?填充:0;什么元素从一开始?如果我重置太多样式/元素会有什么后果吗? 如果你真的想要重置: Carrer blog has one: (github)

/* CSS Mobile Reset */
html, body
{
 margin: 0;
 padding: 0; 
 border: 0;
}

body 
{
 font-family:Arial,  sans-serif;
 line-height:1.5;
 font-size:16px;
 background: #fff;
 padding:5px;
 color: #000;
 word-wrap: break-word;
 -webkit-text-size-adjust: none;
}

h1, h2, h3, h4, h5, h6{ font-weight: normal; }

p img { float: left; margin: 0 10px 5px 0; padding: 0; }

img { border: 0; max-width: 100%; }

table { width:auto; border-collapse: collapse;border-spacing: 0; }

Must read SO post on the matter.
来自Harpo:

How strongly do you believe in CSS reset for the desktop?

I tend to agree with those who argue that CSS resets are too
heavy-handed (have you ever read one? I’d never heard of some of those
elements) and that ultimately, hand-crafted rules based on your actual
needs will be most predictable and efficient.

The mobile platform only makes bandwidth even more precious. I guess
that’s why you’re asking. I’d say, whittle a standard reset down to
what you really need.

如果你进入Boilerplate:there is a for mobile option.

即使您不使用样板,也可能需要为自己添加一些功能.

网友评论