How to Remove Display Flex in CSS? Last Updated : 24 Jul, 2024 Comments Improve Suggest changes Like Article Like Report We use "display flex" property in our CSS code to create a flexible layout. To remove display flex in CSS, We can simply set the display property of the particular element to another value like we can set "flex" to "block" or "inline-block" for our needs.These are the following approaches to remove display flex in CSS:Table of ContentUsing "display: block" propertyUsing "display: inline-block" propertyUsing "display: block" propertyFirst, create a basic HTML structure then inside the <body> tag, add a div element with the class "container" or you can use any other class also.Inside the main div create some other divs for showing properly to remove the display flex property.To remove the display: flex in your code use display: block.Example: The example code below shows how to remove display flex in CSS using display: block. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Display Block Example</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <div class="element">Item 1</div> <div class="element">Item 2</div> <div class="element">Item 3</div> </div> </body> </html> CSS .container { background-color: #f0f0f0; padding: 20px; width: 35vw; margin-left: 25rem; margin-top: 10rem; } .element { background-color: #4CAF50; color: white; margin: 10px 0; padding: 20px; display: block; /* It is helps to remove display: flex */ } Output:Output1Using "display: inline-block" propertyFirst, create a basic HTML structure then inside the <body> tag, add a div element with the class "container" or you can use any other class also.And inside the main div create some other divs for showing properly to remove display flex property.To remove the display:flex in your code use display: inline-block.Example: The example code below shows how to remove display flex in CSS using display: inline-block. HTML <!DOCTYPE html> <html lang="en"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <title>Display Inline-Block Example</title> <link rel="stylesheet" href="style.css"> </head> <body> <div class="container"> <div class="element">Item 1</div> <div class="element">Item 2</div> <div class="element">Item 3</div> </div> </body> </html> CSS .container { background-color: #f0f0f0; padding: 20px; width: 35vw; margin-left: 25rem; margin-top: 10rem; } .element { background-color: #2196F3; color: white; margin: 10px; padding: 20px; display: inline-block; /* It is helps to remove display: flex */ } Output:Output2 Comment More infoAdvertise with us Next Article How to Remove Display Flex in CSS? S skaftafh Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to Disable Flex in CSS? We use "display flex" property in our CSS code to create a flexible layout. To disable flex in CSS, We can simply set the display property of the particular element to another value like we can set "flex" to "block" or "inline-block" for our needs.These are the following approaches: Table of Content 3 min read What is Display Flex in CSS? In CSS, display: flex; is a value of the display property that enables the flexible layout model for arranging the elements in a container. When you can apply the display: flex; to the container element, it can become the flex container and its direct children become the flex items. This layout mode 5 min read How to Display Three Columns Per Row in CSS Flexbox? CSS Flexbox is a one-dimensional layout model that allows items within a container to be arranged in rows or columns with dynamic sizing and alignment. It simplifies the process of creating complex layouts and responsive designs. In this article we will explore approach to arrange columns in a conta 2 min read How to make div elements display inline using CSS ? Displaying div elements inline allows them to share horizontal space and appear in a single line, making your layout more dynamic and responsive. This guide explores different CSS techniques to achieve this, including flexbox, inline-block, float, and span elements.Why Display Div Elements Inline?Re 3 min read How to Prevent Flexbox Shrinking in CSS? The Flexbox is a powerful layout module in CSS that makes it easy to design flexible and responsive layouts. However, one common issue that developers face is preventing the flex items from shrinking. The Flexbox or the Flexible Box Layout is a layout model that allows elements within the container 3 min read Like