CSS display属性定义和用法

开发 前端
CSS display属性用于定义建立布局时元素生成的显示框类型。对于 HTML 等文档类型,如果使用 display属性不谨慎会很危险,可能违反 HTML 中已经定义的显示层次结构。

本文向大家描述一下CSS display属性的定义和用法,CSS display属性主要用来规定元素应该生成的框的类型。对于 XML,由于 XML 没有内置的这种层次结构,所有 display属性是绝对必要的。

CSS display属性定义和用法

CSS display属性规定元素应该生成的框的类型。

说明

 CSS display属性用于定义建立布局时元素生成的显示框类型。对于 HTML 等文档类型,如果使用 display属性不谨慎会很危险,可能违反 HTML 中已经定义的显示层次结构。对于 XML,由于 XML 没有内置的这种层次结构,所有 display属性是绝对必要的。

注释:CSS2 中有值 compact 和 marker,不过由于缺乏广泛的支持,已经从 CSS2.1 中去除了。

CSS display属性

实例

使段落生出行内框:

  1. p.inline  
  2.   {  
  3.   display:inline;  
  4.   }  
  5.  

浏览器支持

所有主流浏览器都支持CSS display 属性。

注释:任何版本的 Internet Explorer (包括 IE8)都不支持 "inherit"、"inline-table"、"run-in"、"table"、"table-caption"、"table-cell"、"table-column"、"table-column-group"、"table-row"、以及 "table-row-group" 属性值。

可能的值
 

CSS display属性可能的值

【编辑推荐】

  1. 探究CSS display属性用法
  2. 探究CSS hack使用原理 规则及弊端
  3. 深入探究DIV CSS布局中position属性用法
  4. CSS属性display:inline-block使用揭秘
  5. CSS hack:实现IE6、IE7、Firefox兼容

 

责任编辑:佚名 来源: w3school.com.cn
相关推荐

2010-08-25 14:26:09

CSSdisplay

2010-09-16 10:04:50

CSSdisplay:tab

2010-09-14 13:05:10

VisibilityDisplayCSS DIV

2010-08-25 09:25:13

CSSmargin

2010-09-15 13:44:01

CSS positio

2010-09-16 10:10:50

CSSdisplay

2010-09-15 17:05:33

CSS display

2010-08-25 13:25:22

CSSfont-family

2010-09-02 12:58:21

display:inlCSS

2010-09-15 14:30:07

CSS backgro

2010-09-02 09:09:38

display:inlCSS

2010-09-10 15:16:51

CSSdisplay

2010-09-07 14:40:10

title属性Alt属性CSS

2010-08-25 13:40:31

CSSfont-weight

2010-09-08 12:37:27

displayCSS

2010-09-01 11:21:18

CSSpositionfloat

2010-09-09 15:08:40

CSSfloatclear

2010-09-16 09:33:33

CSS displayCSS display

2010-09-14 15:32:51

CSSdisplay:inl

2010-09-03 10:18:06

CSSdisplay:inl
点赞
收藏

51CTO技术栈公众号