- CSS - Home
- CSS - Roadmap
- CSS - Introduction
- CSS - Syntax
- CSS - Inclusion
- CSS - Types
- CSS - Measurement Units
- CSS - Selectors
- CSS - Colors
- CSS - Backgrounds
- CSS - Fonts
- CSS - Text
- CSS - Images
- CSS - Links
- CSS - Tables
- CSS - Borders
- CSS - Border Block
- CSS - Border Inline
- CSS - Margins
- CSS - Lists
- CSS - Padding
- CSS - Cursor
- CSS - Outlines
- CSS - Dimension
- CSS - Scrollbars
- CSS - Inline Block
- CSS - Dropdowns
- CSS - Visibility
- CSS - Overflow
- CSS - Clearfix
- CSS - Float
- CSS - Arrows
- CSS - Resize
- CSS - Quotes
- CSS - Order
- CSS - Position
- CSS - Hyphens
- CSS - Hover
- CSS - Display
- CSS - Focus
- CSS - Zoom
- CSS - Translate
- CSS - Height
- CSS - Hyphenate Character
- CSS - Width
- CSS - Opacity
- CSS - Z-Index
- CSS - Bottom
- CSS - Navbar
- CSS - Overlay
- CSS - Forms
- CSS - Align
- CSS - Icons
- CSS - Image Gallery
- CSS - Comments
- CSS - Loaders
- CSS - Attr Selectors
- CSS - Combinators
- CSS - Root
- CSS - Box Model
- CSS - Counters
- CSS - Clip
- CSS - Writing Mode
- CSS - Unicode-bidi
- CSS - min-content
- CSS - All
- CSS - Inset
- CSS - Isolation
- CSS - Overscroll
- CSS - Justify Items
- CSS - Justify Self
- CSS - Tab Size
- CSS - Pointer Events
- CSS - Place Content
- CSS - Place Items
- CSS - Place Self
- CSS - Max Block Size
- CSS - Min Block Size
- CSS - Mix Blend Mode
- CSS - Max Inline Size
- CSS - Min Inline Size
- CSS - Offset
- CSS - Accent Color
- CSS - User Select
- CSS - Cascading
- CSS - Universal Selectors
- CSS - ID Selectors
- CSS - Group Selectors
- CSS - Class Selectors
- CSS - Child Selectors
- CSS - Element Selectors
- CSS - Descendant Selectors
- CSS - General Sibling Selectors
- CSS - Adjacent Sibling Selectors
- CSS Advanced
- CSS - Grid
- CSS - Grid Layout
- CSS - Flexbox
- CSS - Visibility
- CSS - Positioning
- CSS - Layers
- CSS - Pseudo Classes
- CSS - Pseudo Elements
- CSS - @ Rules
- CSS - Text Effects
- CSS - Paged Media
- CSS - Printing
- CSS - Layouts
- CSS - Validations
- CSS - Image Sprites
- CSS - Important
- CSS - Data Types
- CSS3 Advanced Features
- CSS - Rounded Corner
- CSS - Border Images
- CSS - Multi Background
- CSS - Color
- CSS - Gradients
- CSS - Box Shadow
- CSS - Box Decoration Break
- CSS - Caret Color
- CSS - Text Shadow
- CSS - Text
- CSS - 2d transform
- CSS - 3d transform
- CSS - Transition
- CSS - Animation
- CSS - Multi columns
- CSS - Box Sizing
- CSS - Tooltips
- CSS - Buttons
- CSS - Pagination
- CSS - Variables
- CSS - Media Queries
- CSS - Functions
- CSS - Math Functions
- CSS - Masking
- CSS - Shapes
- CSS - Style Images
- CSS - Specificity
- CSS - Custom Properties
- CSS Responsive
- CSS RWD - Introduction
- CSS RWD - Viewport
- CSS RWD - Grid View
- CSS RWD - Media Queries
- CSS RWD - Images
- CSS RWD - Videos
- CSS RWD - Frameworks
- CSS References
- CSS Interview Questions
- CSS Online Quiz
- CSS Online Test
- CSS Mock Test
- CSS - Quick Guide
- CSS - Cheatsheet
- CSS - Properties References
- CSS - Functions References
- CSS - Color References
- CSS - Web Browser References
- CSS - Web Safe Fonts
- CSS - Units
- CSS - Animation
- CSS Resources
- CSS - Useful Resources
- CSS - Discussion
CSS Data Type - <display-inside>
CSS <display-inside> data type determines the inner display of an element, which specifies the formatting context type, for a non-replaced element. These keywords define values for the display property. They can be used as a single keyword for older versions of browsers or along with a value from the <display-outside> keywords.
Possible Values
flow-root − It creates a new block formatting context for an element.
table − The element itself becomes a block-level container that behaves like an HTML table.
flex − The element works as a block-level element and arranges its content based on the flexbox model.
grid − The element works as a block-level element and arranges its content based on the grid model.
Syntax
<display-inside>: flow-root | table | flex | grid;
CSS <display-inside> - flow-root
The following example demonstrates that the display: flow-root property creates a block formatting context and contains the floated elements −
<html>
<head>
<style>
.container {
display: flow-root;
border: 2px solid blue;
padding: 10px;
}
.float-left {
float: left;
height: 30px;
width: 50%;
background-color: pink;
}
.float-right {
float: right;
height: 30px;
width: 50%;
background-color: yellow;
}
</style>
</head>
<body>
<div class="container">
<div class="float-left">Floating Left</div>
<div class="float-right">Floating Right</div>
</div>
</body>
</html>
CSS <display-inside> - table
The following example demonstrates that display: table property defines an element as a table −
<html>
<head>
<style>
.table-container {
display: table;
width: 100%;
border-collapse: collapse;
background-color: pink;
}
.row {
display: table-row;
}
.column {
display: table-cell;
border: 2px solid blue;
padding: 5px;
}
</style>
</head>
<body>
<div class="table-container">
<div class="row">
<div class="column">Row 1, Column 1</div>
<div class="column">Row 1, Column 2</div>
<div class="column">Row 1, Column 3</div>
</div>
<div class="row">
<div class="column">Row 2, Column 1</div>
<div class="column">Row 2, Column 2</div>
<div class="column">Row 2, Column 3</div>
</div>
</div>
</body>
</html>
CSS <display-inside> - flex
The following example demonstrates that display: table property defines an element as a table element −
<html>
<head>
<style>
.flex-container {
display: flex;
align-items: center;
height: 50px;
padding: 5px;
gap: 5px;
background-color: red;
}
.flex-item {
padding: 10px;
border: 2px solid green;
background-color: yellow;
}
</style>
</head>
<body>
<div class="flex-container">
<div class="flex-item">Flex Item 1</div>
<div class="flex-item">Flex Item 2</div>
<div class="flex-item">Flex Item 3</div>
</div>
</body>
</html>
CSS <display-inside> - grid
The following example demonstrates that the display: grid property creates a basic grid layout with three columns and two rows −
<html>
<head>
<style>
.grid-container {
display: grid;
grid-template-columns: 100px 100px 100px;
grid-template-rows: 50px 50px;
gap: 5px;
align-items: center;
background-color: pink;
padding: 5px;
}
.grid-item {
background-color: yellow;
padding: 10px;
text-align: center;
border: 3px solid red;
}
</style>
</head>
<body>
<div class="grid-container">
<div class="grid-item">Grid Item 1</div>
<div class="grid-item">Grid Item 2</div>
<div class="grid-item">Grid Item 3</div>
<div class="grid-item">Grid Item 4</div>
<div class="grid-item">Grid Item 5</div>
<div class="grid-item">Grid Item 6</div>
</div>
</body>
</html>