How to Disable 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 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 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 disable the display flex property.To disable the display: flex in your code use display: block.Example: The example code below shows how to disable 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>Disable Flex Example</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Flexbox Enabled</h1> <p>In this section the flexbox is <strong>Enabled.</strong></p> <div class="container"> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> </div> <h1>Flexbox Disabled</h1> <p>This section has Flexbox disabled, for that we use <strong>display block.</strong></p> <div class="container disable-flex"> <div class="item">Item A</div> <div class="item">Item B</div> <div class="item">Item C</div> </div> </body> </html> CSS body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; } h1 { color: #333; } p { color: #666; font-size: 16px; margin-bottom: 20px; } .container { display: flex; justify-content: center; align-items: center; background-color: #fff; border: 1px solid #ccc; padding: 20px; margin-bottom: 20px; width: 80%; max-width: 800px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .container.disable-flex { display: block; } .item { background-color: #02b72d; padding: 20px; margin: 10px; border-radius: 5px; text-align: center; flex: 1; color: #fff; } Output:Output : Disable flex using display blockUsing "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 disable display flex property.To disable the display:flex in your code use display : inline-block.Example: The example code below shows how to disable 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>Disable Flex Example</title> <link rel="stylesheet" href="style.css"> </head> <body> <h1>Flexbox Enabled</h1> <p>In this section the flexbox is <strong>Enabled.</strong></p> <div class="container"> <div class="item">Item 1</div> <div class="item">Item 2</div> <div class="item">Item 3</div> </div> <h1>Flexbox Disabled</h1> <p>This section has Flexbox disabled, for that we use <strong>display inline-block.</strong></p> <div class="container disable-flex"> <div class="item">Item A</div> <div class="item">Item B</div> <div class="item">Item C</div> </div> </body> </html> CSS body { font-family: Arial, sans-serif; background-color: #f4f4f4; margin: 0; padding: 0; display: flex; flex-direction: column; align-items: center; } h1 { color: #333; } p { color: #666; font-size: 16px; margin-bottom: 20px; } .container { display: flex; justify-content: center; align-items: center; background-color: #fff; border: 1px solid #ccc; padding: 20px; margin-bottom: 20px; width: 80%; max-width: 800px; box-shadow: 0 0 10px rgba(0, 0, 0, 0.1); } .container.disable-flex { display: inline-block; /* It is helps to disable display: flex */ } .item { background-color: #02b72d; padding: 20px; margin: 10px; border-radius: 5px; text-align: center; flex: 1; color: #fff; } Output:Output : Disable flex using display inline block Comment More infoAdvertise with us Next Article How to Disable Flex in CSS? S skaftafh Follow Improve Article Tags : Web Technologies CSS CSS-Questions Similar Reads How to Disable Flash in Chrome? Google Chrome is a web browser developed by Google. It requires a flash player to watch videos, play high-resolution games, etc. Flash player supports all high resolutions media/graphics. It is an essential plugin for the Google Chrome Web browser as well as other browsers too to work with high-end 1 min read How to Remove Display Flex in CSS? 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 2 min read How to Disable Equal Width Columns in CSS Flexbox? With CSS Flexbox, developers can easily create complex and responsive layouts due to its powerful layout module. Its capacity to create equal-height columns inside flex containers is one of its features. There are situations, though, in which you might want to turn this behavior off and allow the he 2 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 disable a link using only CSS? To disable a link using CSS, pointer-events can be used, which sets whether the element in the page has to respond or not while clicking on elements. The pointer-events property is used to specify whether the element should respond to pointer events or not. The following example illustrates this app 3 min read Like