YouTip LogoYouTip

Prop Style Display

HTML DOM Style display Property\\n\\n* * *\\n\\n## Definition and Usage\\n\\nThe display property sets or returns the element's display type.\\n\\nMost elements in HTML are either "inline" or "block" elements: an inline element has floating content on both its left and right sides. A block element fills the entire line, and there is nothing to display on its left or right.\\n\\nThe display property also allows authors to show or hide an element. Similar to the visibility property. However, if you set display:none, the entire element will be hidden, if you set visibility:hidden, the element's content will be invisible, but the element retains its original position and size.## Syntax\\n\\nSet the display property:\\n\\nObject.style.display="_value_"\\n\\nReturn the display property:\\n\\nObject.style.display\\n\\n| Value | Description |\\n| --- | --- |\\n| block | Element is displayed as a block-level element. |\\n| compact | Element is displayed as a block-level element or inline element, depending on context. |\\n| inherit | The value of display is inherited from parent element. |\\n| inline | Default. Element is displayed as an inline element. |\\n| inline-block | Element is displayed as an inline box inside a block box. |\\n| inline-table | Element is displayed as an inline table (similar to ), with no line breaks before or after the table. |\\n| list-item | Element is displayed as a list. |\\n| marker | This value sets content as a marker before and after the box (used with :before and :after pseudo-elements, otherwise this value is the same as "inline"). |\\n| none | Element is not displayed. |\\n| run-in | Element is displayed as a block-level or inline element, depending on context. |\\n| table | Element is displayed as a block-level table (similar to
), with line breaks before and after the table. |\\n| table-caption | Element is displayed as a table caption (similar to ). |\\n| table-column-group | Element represents a group of one or more columns (similar to ). |\\n| table-footer-group | Element represents a table footer row (similar to ). |\\n| table-header-group | Element represents a table header row (similar to ). |\\n| table-row | Element is displayed as a table row (similar to ). |\\n| table-row-group | Element represents a group of one or more rows (similar to ). |\\n\\n* * *\\n\\n## Browser Support\\n\\n![Image 2: Internet Explorer]( 3: Firefox]( 4: Opera]( 5: Google Chrome]( 6: Safari](\\n\\nAll major browsers support the display property.\\n\\n**Note:** IE7 and earlier versions do not support the "inherit" value. IE8 only supports "inherit" when !DOCTYPE is specified. IE9 supports "inherit".\\n\\n* * *\\n\\n## Tips and Notes\\n\\n**Tip:** If the element is a block element, its display type can be changed through the float property.\\n\\n* * *\\n\\n## Example\\n\\n## Example\\n\\nWhen the button is clicked, set the element to be invisible:\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n\\n

This is some text.

\\n\\n

This is some text.

\\n\\n\\n\\n\\n\\n \\n\\n\\n\\n[Try it yourself Β»](\\n\\n* * *\\n\\n[![Image 7: Style ObjectsReference Manual]( Style Objects](
← Prop Style HeightProp Style Cursor β†’

YouTip © 2024-2026 | Home | Learn Technology, Build Dreams!

All content is for educational and learning purposes only.

). |\\n| table-cell | Element is displayed as a table cell (similar to
and ). |\\n| table-column | Element represents a column of cells (similar to