日期:2014-05-17  浏览次数:20658 次

移动网站CSS--手机浏览器css规则

?

Mobile css的标准也是有些复杂的,与前一篇文章中提到的类似,之前存在着一个W3C制定的CSS Mobile Profile 1.0以及OMA的WAP CSS 1.0,事实上它们都是CSS 2.1的子集,而且内容非常接近,不同的是,WAP CSS 1.0针对移动设备加入了一些扩展,这些扩展通过-wap-前缀来实现。

后来,W3C将二者进行了整合,吸收了WAP CSS1.0的一些优点,推出了CSS Mobile Prifile 2.0规范,它也是CSS 2.1的一个子集。我们本文将主要讨论这个规范。

CSS Mobile Profile 2.0中的CSS支持

因为这是CSS 2.1的一个子集,那么我们对这个规范的内容应该不会陌生,我们通过这个表格可以很直观的看到CSS MP对CSS的支持情况:

支持的不支持的选择器背景和边框定位列表基本的盒模型色彩字体文字线形基本的用户界面滚动
全局选择器(*)、类型选择器(比如h1, div, p等)、子选择器(p>span)、链接伪类 (:link,:visited)、动态伪类(:active, :focus)、类选择器、id选择器、分组(h1,h2,h3{}…) :first-child、:hover 、:lang() 伪类, :first-letter 、:first-line 伪元素, 兄弟选择器(比如h1 + p),属性选择器 (比如 a[href], a[target="_blank"])
background, background-color, background-image, background-repeat, background-attachment, background-position, border, border-width, border-color, border-style(注1)
position, top, right, bottom, left, z-index
list-style, list-style-image, list-style-type list-style-position
display(注2), margin, padding, height, min-height, max-height, width, min-width, max-width, float, clear, visibility, overflow(注3), overflow-style(注4)
color
font, font-family, font-style, font-variant, font-weight, font-size(注5)
text-indent, text-align, text-decoration(注6), text-transform, white-space word-spacing, letter-spacing, unicode-bidi
vertical-align(注7) line-height
utline, outline-color, outline-style, outline-width cursor
marquee-style, marquee-direction, marquee-play-count, marquee-speed