IE8面向Web开发人员的功能改进

繁简对译:[]  字体设置:[] 2009-06-30  作者:大魏  来源:学术部  阅读  次

CSS改进

Windows Internet Explorer 8 是迄今为止 CSS 符合性最高的版本,它完全支持级联样式表 (CSS) 级别 2.1,并加强了对 CSS 3支持。下面是最为突出的几个亮点:
数据统一资源标识符 (URI)(最长32768个字符)
此机制允许网页作者直接在 URI 中嵌入小型实体,而不是使用 URI 标识检索实体的位置。此操作主要适用于在 CSS 或布局中使用的小图像(如项目符号)。

  1. 新伪类
    以下是 Windows Internet Explorer 8 新增的内容:
    :before 和 :after 伪元素允许作者指定与元素的文档树内容有关的动态内容的位置。
    :focus 指的是用户何时激活元素以使它可以执行任务。此伪类适用于元素具有输入焦点的情况。
    Outline 可以突出显示元素,但不会影响其大小。它是 outline-color、outline-style 和 outline-width 的简化属性。
  2. 打印
    为了简化打印,已添加了下列属性:
    page-break-inside
    widows
    orphans
  3. 表格布局
     多年来,表格始终是 Internet 上的首选布局机制。在 Windows Internet Explorer 8 中,现在可以使用 display 属性将表格类型格式应用于非表格元素。实际上,CSS 表格比 HTML 标记更灵活;使用 CSS 规则创建的表格嵌套元素后即有效,而使用 HTML 创建的表格会关闭容器以避免意外嵌套。

下表收集了 Windows Internet Explorer 8 中支持的各种改进的 CSS 属性,并与 Windows Internet Explorer 7 进行了比较,内容一目了然。这些表未详尽列出 Windows Internet Explorer 8 支持的所有 CSS 属性;只显示了 Windows Internet Explorer 7 不支持或部分支持,而现在 Windows Internet Explorer 8 支持的 CSS 属性。

单元格中的“部分”值表示只能在该版本的 Windows Internet Explorer 中部分实现此功能。

伪类

CSS 2.1

 

IE 7.0

IE 8.0

active { sRules } :

:active

部分

after { sRules } :

:after

before { sRules } :

:before

focus { sRules } :

:focus

lang(C) { sRules } :

lang():

列表

 CSS 2.1 

 

IE 7.0 

IE 8.0 

{ list-style-type :sStyle } 

list-style-type

部分

颜色和背景

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ background-position :sPosition } 

background-position

部分

字体和文本

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ font-weight :sWeight } 

font-weight

部分

{ white-space :sWrap } 

white-space 

部分

{ word-spacing :sSpacing } 

word-spacing 

部分

生成的内容

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ content :sContent } 

content

{ counter-increment :sCounter } 

counter-increment

{ counter-reset :sCounter } 

counter-reset

{ quotes :sQuotes } 

quotes 

边框和布局

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ border-collapse :sCollapse } 

border-collapse

部分

{ border-spacing :sSpacing } 

border-spacing

{ border-style :sStyle } 

border-style

部分

{ caption-side :sLocation } 

caption-side

{ empty-cells :sEmptyCells } 

empty-cells 

部分

定位

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ bottom :sBottom } 

bottom

部分

{ display :sDisplay } 

display

部分

{ left :sPosition } 

left

部分

{ right :sPosition } 

right

部分

{ top :sTop } 

top

部分

{ z-index :vOrder } 

z-index

部分

打印

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ orphans :nLines } 

orphans

{ page-break-inside :sBreak } 

page-break-inside

{ widows :nLines } 

widows

用户界面

CSS 2.1  

 

IE 7.0 

IE 8.0 

{ outline :sOutline } 

outline

{ outline-color :sColor } 

outline-color

{ outline-style :sStyle } 

outline-style

{ outline-width :sWidth } 

outline-width

CSS 3  

 

IE 7.0 

IE 8.0 

{ box-sizing :sSizing } 

box-sizing 

函数

CSS 2.1  

IE 7.0 

IE 8.0 

counter() 

attr() 

关键字

CSS 2.1  

IE 7.0 

IE 8.0 

Inherit 

文本兼容性模式 

Windows Internet Explorer 8 精心构建了一种新的布局引擎,该引擎提供全面的 CSS 2.1 支持和强大的 HTML 5 支持以及文档对象模型 (DOM) 的互操作性修补程序。默认情况下,将启用标准支持的最高级别。网站作者可以使用以下 META 标记在 Windows Internet Explorer 8 中选择 EmulationIE7 模式呈现:

<meta http-equiv=”X-UA-Compatible” content=”IE=EmulateIE7″ />

开发工具

Windows Internet Explorer 8 中增强的开发工具可提供网页的内部元素,有助于研究和解决 HTML、CSS 和脚本方面的问题。包含下列工具:
CSS 工具,用于显示您的网页加载的样式表所定义的各种规则。
脚本调试,一种内置轻型调试器,让您无需退出 Windows Internet Explorer 即可设置断点并查看客户端脚本。
版本模式切换,允许您切换到其他浏览器模式以测试内容是否符合标准符合性。
探查器,一种内置工具,用于显示浏览器在哪个执行阶段花费了大量时间,以便网页作者重点进行优化。

打印 收藏 关闭