开发手册HTMLCSSJavaScript
HTML手册CSS手册CSSCSS3CSS相关CSS 字体系列CSS3 animation-delay 属性CSS3 animation-direction 属性CSS3 animation-duration 属性CSS3 animation-fill-mode 属性CSS3 animation-iteration-count 属性CSS3 animation-name 属性CSS3 animation-play-state 属性CSS3 animation-timing-function 属性CSS3 animation 属性CSS3 appearance 属性CSS3 backface-visibility 属性CSS background-attachment 属性CSS3 background-clip 属性CSS background-color 属性CSS background-image 属性CSS3 background-origin 属性CSS background-position 属性CSS background-repeat 属性CSS3 background-size 属性CSS background 属性CSS3 border-bottom-left-radius 属性CSS3 border-bottom-right-radius 属性CSS border-bottom 属性CSS border-bottom-color 属性CSS border-bottom-style 属性CSS border-bottom-width 属性CSS border-color 属性CSS3 border-image-outset 属性CSS3 border-image-repeat 属性CSS3 border-image-slice 属性CSS3 border-image-source 属性CSS3 border-image-width 属性CSS3 border-image 属性CSS border-left 属性CSS border-left-color 属性CSS border-left-style 属性CSS border-left-width 属性CSS3 border-radius 属性CSS border-right 属性CSS border-right-color 属性CSS border-right-style 属性CSS border-right-width 属性CSS border-style 属性CSS3 border-top-left-radius 属性CSS3 border-top-right-radius 属性CSS border-top 属性CSS border-top-color 属性CSS border-top-style 属性CSS border-top-width 属性CSS border-width 属性CSS border 属性CSS3 box-align 属性CSS3 box-direction 属性CSS3 box-flex-group 属性CSS3 box-flex 属性CSS3 box-lines 属性CSS3 box-ordinal-group 属性CSS3 box-orient 属性CSS3 box-pack 属性CSS3 box-shadow 属性CSS3 box-sizing 属性CSS clear 属性CSS cursor 属性CSS display 属性CSS float 属性CSS position 属性CSS visibility 属性CSS3 column-count 属性CSS3 column-fill 属性CSS3 column-gap 属性CSS3 column-rule-color 属性CSS3 column-rule-style 属性CSS3 column-rule-width 属性CSS3 column-rule 属性CSS3 column-span 属性CSS3 column-width 属性CSS3 columns 属性CSS height 属性CSS line-height 属性CSS max-height 属性CSS max-width 属性CSS min-height 属性CSS min-width 属性CSS width 属性CSS font-family 属性CSS font-size-adjust 属性CSS font-size 属性CSS font-stretch 属性CSS font-style 属性CSS font-variant 属性CSS font 属性CSS font-weight 属性CSS content 属性CSS counter-increment 属性CSS counter-reset 属性CSS quotes 属性CSS3 grid-columns 属性CSS3 grid-rows 属性CSS3 hanging-punctuation 属性CSS3 icon 属性CSS3 @keyframes 规则CSS list-style-image 属性CSS list-style-position 属性CSS list-style-type 属性CSS list-style 属性CSS margin-bottom 属性CSS margin-left 属性CSS margin-right 属性CSS margin-top 属性CSS margin 属性CSS3 nav-down 属性CSS3 nav-index 属性CSS3 nav-left 属性CSS3 nav-right 属性CSS3 nav-up 属性CSS3 opacity 属性CSS outline-color 属性CSS3 outline-offset 属性CSS outline-style 属性CSS outline-width 属性CSS outline 属性CSS3 overflow-style 属性CSS3 overflow-x 属性CSS3 overflow-y 属性CSS padding-bottom 属性CSS padding-left 属性CSS padding-right 属性CSS padding-top 属性CSS padding 属性CSS3 perspective-origin 属性CSS3 perspective 属性CSS bottom 属性CSS clip 属性CSS left 属性CSS overflow 属性CSS right 属性CSS top 属性CSS vertical-align 属性CSS z-index 属性CSS page-break-after 属性CSS page-break-before 属性CSS page-break-inside 属性CSS :active 伪类CSS :after 伪元素CSS :before 伪元素CSS :first-child 伪类CSS :first-letter 伪元素CSS :first-line 伪元素CSS :focus 伪类CSS :hover 伪类CSS :lang 伪类CSS :link 伪类CSS :visited 伪类CSS3 punctuation-trim 属性CSS3 resize 属性CSS3 rotation-point 属性CSS3 rotation 属性CSS border-collapse 属性CSS border-spacing 属性CSS caption-side 属性CSS empty-cells 属性CSS table-layout 属性CSS3 target-name 属性CSS3 target-new 属性CSS3 target-position 属性CSS3 target 属性CSS3 text-emphasis 属性CSS3 text-justify 属性CSS3 text-outline 属性CSS3 text-overflow 属性CSS3 text-shadow 属性CSS3 text-wrap 属性CSS color 属性CSS direction 属性CSS letter-spacing 属性CSS text-align 属性CSS text-decoration 属性CSS text-indent 属性CSS text-transform 属性CSS white-space 属性CSS word-spacing 属性CSS3 transform-origin 属性CSS3 transform-style 属性CSS3 transform 属性CSS3 transition-delay 属性CSS3 transition-duration 属性CSS3 transition-property 属性CSS3 transition-timing-function 属性CSS3 transition 属性CSS unicode-bidi 属性CSS3 word-break 属性CSS3 word-wrap 属性CSS :active 选择器CSS :after 选择器CSS * 选择器CSS3 [attribute^=value] 选择器CSS3 [attribute*=value] 选择器CSS3 [attribute$=value] 选择器CSS [attribute] 选择器CSS [attribute=value] 选择器CSS [attribute~=value] 选择器CSS [attribute|=value] 选择器CSS :before 选择器CSS3 :checked 选择器CSS .class 选择器CSS3 :disabled 选择器CSS element 选择器CSS element,element 选择器CSS element element 选择器CSS element>element 选择器CSS element+element 选择器CSS3 :empty 选择器CSS3 :enabled 选择器CSS :first-child 选择器CSS :first-letter 选择器CSS :first-line 选择器CSS3 :first-of-type 选择器CSS :focus 选择器CSS3 element1~element2 选择器CSS :hover 选择器CSS #id 选择器CSS :lang 选择器CSS3 :last-child 选择器CSS3 :last-of-type 选择器CSS :link 选择器CSS3 :not 选择器CSS3 :nth-child() 选择器CSS3 :nth-last-child() 选择器CSS3 :nth-last-of-type() 选择器CSS3 :nth-of-type() 选择器CSS3 :only-child 选择器CSS3 :only-of-type 选择器CSS3 :root 选择器CSS3 ::selection 选择器CSS3 :target 选择器CSS :visited 选择器JavaScript手册

CSS display 属性

实例

使段落生出行内框:

p.inline
  {
  display:inline;
  }

亲自试一试

浏览器支持

IE Firefox Chrome Safari Opera

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

注释:如果规定了 !DOCTYPE,则 Internet Explorer 8 (以及更高版本)支持属性值 "inline-table"、"run-in"、"table"、"table-caption"、"table-cell"、"table-column"、"table-column-group"、"table-row"、"table-row-group"、以及 "inherit"。

定义和用法

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

说明

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

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

默认值: inline
继承性: no
版本: CSS1
JavaScript 语法: object.style.display="inline"

可能的值

描述
none 此元素不会被显示。
block 此元素将显示为块级元素,此元素前后会带有换行符。
inline 默认。此元素会被显示为内联元素,元素前后没有换行符。
inline-block 行内块元素。(CSS2.1 新增的值)
list-item 此元素会作为列表显示。
run-in 此元素会根据上下文作为块级元素或内联元素显示。
compact CSS 中有值 compact,不过由于缺乏广泛支持,已经从 CSS2.1 中删除。
marker CSS 中有值 marker,不过由于缺乏广泛支持,已经从 CSS2.1 中删除。
table 此元素会作为块级表格来显示(类似 <table>),表格前后带有换行符。
inline-table 此元素会作为内联表格来显示(类似 <table>),表格前后没有换行符。
table-row-group 此元素会作为一个或多个行的分组来显示(类似 <tbody>)。
table-header-group 此元素会作为一个或多个行的分组来显示(类似 <thead>)。
table-footer-group 此元素会作为一个或多个行的分组来显示(类似 <tfoot>)。
table-row 此元素会作为一个表格行显示(类似 <tr>)。
table-column-group 此元素会作为一个或多个列的分组来显示(类似 <colgroup>)。
table-column 此元素会作为一个单元格列显示(类似 <col>)
table-cell 此元素会作为一个表格单元格显示(类似 <td> 和 <th>)
table-caption 此元素会作为一个表格标题显示(类似 <caption>)
inherit 规定应该从父元素继承 display 属性的值。

TIY 实例

如何把元素显示为内联元素
本例演示如何把元素显示为内联元素。
如何把元素显示为块级元素
本例演示如何把元素显示为块级元素。

相关页面

CSS 教程:CSS 定位

HTML DOM 参考手册:display 属性

关于千图| 赞助千图 |千图首页   Copyright2014千图网   沪ICP备10011451号-6   用时:0.0192秒

千图网提示