``The flex item remains on the same row and does not move to the next one (

What could be causing the flex item to not move to the next row?

The flex item seems to just shift to the side instead of wrapping.

.section-header {
  border-top: 1px solid #eee;
  //padding-bottom: 20px;
  background: blue;
}

.section {
  margin-top: 20px;
  background: orange;
  padding: 20px;
}

.desc-label {
  padding-top: 10px;
  flex: 1 0 100%;
  height: 100px;
  background: green;
}

.row {
  width: 50%;
  max-width: 700px;
  margin: 0 auto;
  display: flex;
  //flex-direction: column;
  //align-items: flex-start;
  padding-top: 20px;
  background: lightblue;
  height: 400px;
}

.section-title {
  flex: 1 0 100%;
  height: 100px;
  background: purple;
}
<div class="section">
  <div class="row section-header">
    <div class="section-title">Engine</div>
    <div class="desc-label">Template Element: Recipe Ingredient</div>
  </div>
</div>

https://codepen.io/anon/pen/rQVbMr

Answer №1

By default, a flex container is initially set to flex-wrap: nowrap, which forces flex items to remain on a single line.

To change this behavior, you can override the default setting by adding flex-wrap: wrap to the container (see updated demo).

For more information on the flex-wrap property, visit: https://developer.mozilla.org/en-US/docs/Web/CSS/flex-wrap

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Discover the array of results by implementing a while loop in JavaScript

My goal is to create a list of outputs that are not evenly divisible by numbers smaller than the input value. For example, if the input value is 10, the list should be 10, 9, 8, 7, 6, 4, 3, 1. I have written some code in JavaScript for this purpose, but ...

Revamping the Look: Refreshing Background of Div

I'm attempting to change the background image of the body element on a webpage when I hover over links with data-* attributes. It's working perfectly, but I can't seem to figure out how to create a smooth fade between the images when a link ...

Customizing the color of the thumbs on a Material UI range slider

Hey there, currently working on creating a range slider with 2 values using the material UI slider component. My goal is to customize the two thumbs with different colors. https://i.sstatic.net/BUq12.png Any ideas on how I can achieve this? ...

Make CKEDITOR cease the unwrapping of blocks

Imagine I have the following block markup: <div class="block"> <a href="/"> <div class="divInside"></div> <img src="/bla" /> <p>Paragraph</p> </a> </div> HTML5: explain ...

What is the method to indicate the location for placing values in an HTML form for a GET request?

Scenario I am working on a scratch project where I have created a sign-in page using Google Sites. To manipulate the output of the username block, I am utilizing forkphorus. In my Scratch project, I have developed a script that extracts the username string ...

Does the margin fall within the element's boundaries?

Consider this code: <html> <head> <title>Understanding CSS Box Model</title> </head> <body> <section> <h1>An example of h1 inside a section</h1> </section> </body> </html& ...

Stop elements from overextending within their parent container

I am facing an issue with two divs that are wrapped inside a container div. The bottom div contains a dynamically filled table, which determines the overall width of all the divs. On the top div, I want to display several small red blocks that need to tak ...

Show a few values as a string in Angular using Typescript

I am working with JSON data and I want to know how to display hobbies without including the word "all" in an Angular/TypeScript application. { "Name": "Mustermann1", "Vorname": "Max1", "maennlich& ...

When the route is modified, the image fetched from the JSON disappears

When using a div tag to display JSON values on an image, I noticed that the values disappear when navigating to other pages and then returning to the home page. This issue is occurring as I develop with Angular.js NumberJson.get().then(function (resul ...

Enlarge the input field when it is selected

Is there a way to expand a search box towards the left instead of the right when focused? The code provided below expands the search box to the right. HTML: <input type="text" placeholder="search"> CSS: input[type="text"] { background: #444; ...

Image remains fluid within a static div without resizing

Any assistance would be greatly appreciated. I am currently facing an issue with a fixed div that is floating at the bottom of the screen, serving as ad space for the mobile version of a website. The problem arises when attempting to resize the browser win ...

Issue with React Google Maps persists with StandaloneSearchBox in code causing it to be stuck on "Loading" status

I am developing a React JS page where I want to enable companies to register on my website and add their locations for rentals, purchases, etc. The main feature I need is to implement Markers on the map. While I have successfully integrated Google Maps ont ...

Formatting your HTML tags in Visual Studio

For instance, I have this particular tag with concise content <div>It is brief</div> However, upon formatting, Visual Web Developer presents it as <div> It is brief</div> which is unattractive. What I desire is <div> ...

Is there a way to enlarge the gomap popup window size?

Is there a way to make my goMap-driven popup windows larger so that they do not require scroll bars? How can I adjust the height and width of the popup window? This is the jQuery and HTML code I am currently using: $("#map").goMap({ address: ' ...

Is it possible to enable auto play on HTML5 Video for iPad similar to BBC iPlayer?

Can HTML5 Videos automatically play on iPads? I used to believe that it wasn't possible because of iOS restrictions, but after trying BBC iPlayer on my iPad, I noticed that the videos did autoplay upon loading. Could this indicate that it is indeed ...

Using AREA Coordinates to create a custom Image Map with Image-Based Rollovers, incorporating jQuery for enhanced functionality if desired

I am looking for a solution similar to this: http://plugins.jquery.com/project/maphilight However, instead of just adding a border or fill color to <AREA> tags on rollover, I need them to display a background image. The image should be clipped by t ...

The functionality of the tree-view feature in NodeJs is experiencing glitches

My attempt at creating a Tree-view has hit a snag. The collapse icon is not being displayed as expected. Here is the code snippet I tried: <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-treeview/1.2.0/bootst ...

Excellent Read on Form Design without the Use of Tables

Looking for tips on creating a form layout without using tables. I've searched online but haven't found anything helpful. In my form, there are multiple sections with their own forms, each containing 2 or 4 columns. I need a universal stylesheet ...

Is it possible to halt the current appearance of a HTML element temporarily?

In my intricate web application, I have multiple modal editors that require a short animation upon opening. However, before initializing the editor and beginning the animation, I must first DEINITIALIZE the main user interface due to its heavy resource usa ...

Circular Segment Button in Ionic 2

Is there a way to change the appearance of a segment button from square to round using CSS? https://i.sstatic.net/KRjSh.png I attempted to use traditional CSS, but encountered issues when Ionic2 attempted to transform the button on segment-activated. You ...