CSS:详解移动网站开发的前端技术

来源:百度文库 编辑:神马文学网 时间:2024/04/27 22:08:02
Mobile css的标准并不像大家想象的那么简单,与前一篇文章中提到的类似,之前存在着一个W3C制定的CSS Mobile Profile 1.0以及OMA的WAP CSS 1.0,事实上它们都是CSS 2.1的子集,而且内容非常接近,想区别的是,WAP CSS 1.0针对移动设备加入了一些扩展,这些扩展通过-wap-前缀来实现。

CSS Mobile Profile 2.0中的CSS支持

看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 无 @规则 @charset, @import, @media(注8), @namespace @page

  • 注1:border-style只支持常用的none、dotted、dashed、solid和inherit,其它的几个并没有被列入规范。
  • 注2:display仅限于inline、block、list-item、none和inherit,不支持run-in和inline-block
  • 注3:overflow只支持auto
  • 注4:overflow-sytle只支持marquee值
  • 注5:font-size只支持大小关键词,比如small、medium、bigger等,px、pt和百分比等不被支持。
  • 注6:text-decoration只支持none、blink、underline和inherit等,overline、line-trough不被支持。
  • 注7:vertical-align 只支持top, middle, bottom, baseline 和inherit。sub, super, text-top, text-bottom, 百分比和长度不被支持
  • 注8:@media规则只支持 handheld 和all 媒体类型。