首页 > 开发 > CSS > 正文

CSS在移动网站开发的前端技术和技巧

2024-07-11 08:26:34
字体:
来源:转载
供稿:网友

介绍

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
@规则 @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 媒体类型。
发表评论 共有条评论
用户名: 密码:
验证码: 匿名发表