html css display,CSS DISPLAY

This property specifies the type of rendering box used for an element. In a language such as HTML where existing elements have well-defined behavior, default ‘display’ property values are taken from behaviors described in the HTML specifications or from the browser/user default stylesheet. In languages where display behavior is not defined (like XML), the default value is ‘inline’.

In addition to the many different allowed display box types, one other value, “none”, allows the display of an element to be turned off; all child elements also have their display turned off. The document is rendered as though the element did not exist in the document tree. This value allows for powerful capabilities, but should be used with caution.

Example

p {

display: block

}

content

Inline

This is the default behavior for elements. They behave the same way are when you wrap text on elements within a string without producing any break on the actual text. So elements and text live together inline.

inlineelement.png

Elements that are set as inline can distort the flow of the text horizontally, but not vertically, by adding margin or padding to it. However, elements that are set as inline, will ignore height and width properties if they are set.

inlineelement2.png

Inline Block

This behavior is very similar to the inline one, but width and height are not ignored.

inlineblock.png

Block

Container elements like div, ul, etc are set to this type of display by the browser’s UA stylesheet. Elements that are ‘block’ will break from the natural inline flow. By default, these elements will be displayed with as much width as it’s possible by the space provided.

block.png

Possible Values

inherit: Explicitly sets the value of this property to that of the parent.

none: This value turns off the display of an element (it has no effect on layout); all child elements also have their display turned off unconditionally. The document is rendered as though the element did not exist in the document tree. To render an element box’s dimensions in the document formatting scheme, yet have its contents be invisible, see the ‘visibility’ property.

inline: This causes the element to generate one or more inline element boxes.

block: This causes the element to generate a block element box.

inline-block: Introduced in CSS 2.1. This causes the element to generate a block element box that will be flowed with surrounding content as if it were an single inline box (behaving much like a replaced element would.)

list-item: This causes the element to generate a block box for the content and a separate list-item inline box.

marker: This causes an additional marker box to be generated along with the content box. Generated content using the :before and :after pseudo-elements with this display value will place content in the marker box. If a marker is used with another type of element, the value is treated as “in-line.” The position of the marker will lie outside the block box.

compact: Depending on context, this value for the display property creates either an in-line or block level rendering box. In each case different CSS properties may apply to the compact element. In a block level context, the compact element is rendered in the left or right margin of the block element. The compact element participates in line-height calculations for the current line, and the ‘vertical-align’ property value is relative to the block element.

run-in: Depending on context, this value for the display property creates either an in-line or block level rendering box. In each case different CSS properties may apply to the run-in element. Properties for the run-in element are inherited from its parent element in the document tree, not from the block element box it participates in.

[table-header-group|table-footer-group]: These values cause the element to behave like the corresponding THEAD and TFOOT HTML table elements which these values take their name from.

table: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

inline-table: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

table-caption: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

table-cell: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

table-row|table-row-group: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

table-column|table-column-group: These values cause the element to behave like the corresponding HTML table element which these values take their name from. The ‘inline-table’ value does not have a direct mapping in HTML.

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值