The flexibility of the flex-wrap property does not extend to affect nested elements

Check out this example first: http://jsfiddle.net/8ofrs0y7/14/

     <div class="flex-group">
          <ul class="flex-container red">
            <li class="flex-item"&g;1</li>
            <li class="flex-item"&g;2</li>
            <li class="flex-item"&g;3</li>
          </ul>
        
          <ul class="flex-container gold">
            <li class="flex-item"&g;1<:/li>
            <li class="flex-item"&g;2<:/li>
            <li class="flex-item"&g;3</li>
            <li class="flex-item"&g;4</li>
            <li class="flex-item"&g;5</li>
          </ul>
        
          <ul class="flex-container blue">
            <li class="flex-item">1</li>
            <li class="flex-item">2</li<
            <li class="flex-item">3</li>
            <li class="flex-item">4</li>
            <li class="flex-item">5</li>
            <li class="flex-item">6</li>
            <li class="flex-item">7</li>
            <li class="flex-item">8</li>
          </ul>
        <div>
    <style>
        .flex-group {
          display: flex;
          flex-direction: row;
          width: 500px;
          flex-wrap: wrap;
        }
        
        .flex-container {
          display: flex;
          flex-direction: row;
          flex-wrap: wrap;
          list-style: none;
        }
        
        .red li {
          background: red;
        }
        
        .gold li {
          background: gold;
        }
        
        .blue li {
          background: deepskyblue;
        }
        
        .flex-item {
          width: 100px;
          height: 100px;
          margin-left: 10px;
        }
    </style>

Each flex element starts on a new line, even though their child elements can still fit in the .flex-group container.

Is it possible to have two squares of the same color on different lines?

Answer №1

The width of the div with the class name flex group was set to 500px for some reason, but it is recommended to remove this styling.

To revert back, simply eliminate width:500px

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

Adding CSS stylesheets on-the-fly in JavaFX

I am looking to incorporate a CSS file from the filesystem into my application. The goal is to allow users to dynamically add JavaFX CSS files that can be created by anyone and stored anywhere on their system. I attempted a test scenario to see if adding ...

Modify THREE.Mesh.position when slider value changes

Hey everyone, I've been tinkering with mesh translations using the Three.js library. I've set up HTML sliders to dynamically update the values within my project through JavaScript. Here's an example of what I'm working on: https://i.s ...

Is it possible to have an input field that is read-only without altering the mouse icon

echo '<input type="text" class="form-control" value="' . $server->address . ":" . $server->connection_port . '">'; Can readonly mode be activated for this input without altering its CSS or the mouse icon when hovering over ...

Encountering a CSS syntax error within CodeSandbox when attempting to input code within brackets

Why is it that I don't see syntax errors in VSCode, but always encounter them in CodeSandbox? What could be causing this discrepancy and how can I resolve it? Any advice would be greatly appreciated. Thank you in advance. Here's an example of th ...

Creating a clear division between the jumbotron and column divs using whitespace in Bootstrap design

Having some issues with my Bootstrap layout. I have a jumbotron div at the top, which looks fine, but the columns and rows underneath are not aligning properly and seem to be wider than they should be. I suspect it might have something to do with the grid ...

Angular click event to compute a function and display the result on a separate page

Currently, I am developing a BMI app using Ionic Angular (latest version). The objective is to create a button that collects input data from fields and triggers a method to validate the inputs. Once validated, the app should display the results page with t ...

How can I convert an NSAttributedString to mimic the <pre> tag formatting?

Currently, I am extracting HTML tags to display in a UITextView using NSAttributedStrings. I am uncertain about how text enclosed in <pre> tags should appear in a UITextView as an attributed string. Is it simply displayed in Courier font, or does t ...

Drop down list not showing array values

I am attempting to populate a dropdown list with elements from an array using the Document Object Model (DOM) within a for loop. However, I keep encountering an error stating that the dropdown list is null. Here is the JavaScript code I am using: var st ...

Switching the sorting criteria from 'AND' to 'OR' in the JPList library

I am currently exploring the use of JPList to sort on multiple items. As it stands, JPList searches like 'AND' when sorting (e.g. sorting based on an item with tags html, php and jQuery all together), but I am interested in filtering through all ...

Looking for assistance with automated web testing using selenium

I am currently using Selenium to carry out testing on a web application, but I have encountered an issue. One of the nodes that needs to be clicked has a value that constantly changes upon startup. For example: click css=#f0012 > ins.jstree-icon At s ...

Steps to correct alignment in a numbered list when the dot is removed using CSS

Currently, I'm working on developing a rule page for a game. The specific layout requirements dictate that the rules be presented in an ordered list without periods following each number: 1 Rule one 2 Rule two 3 Rule three To achieve this format ...

The issue with scrolling in the Chrome app arises when a fixed element is present, causing the scroll

I am experiencing an issue with my chrome app. The main window displays correctly, but the mouse scroll wheel does not work. Interestingly, when I open the main.html file in Chrome directly, the scrolling works perfectly fine. How can I troubleshoot and fi ...

I am looking to expand the width of the Bootstrap container specifically for the Max width

I need to adjust the width of the Bootstrap container to be responsive on all devices, especially maximizing the width on larger screens. Can anyone provide guidance on how to achieve this? Thank you in advance. To view my website, please follow this link ...

Distinct headings break up two-columned lists

Is there a way to ensure that the h2 header always stays with its list items, even if the number of list items varies? Currently, the header appears in one column and the lists appear in another column, causing them to be separated when the list count chan ...

Ensure that the CSS data-step attribute is replaced with the use of a span element

Hi there, I'm currently working with a step bar template that you can find at the following link: http://codepen.io/mattdrose/pen/qEZBge My issue arises when dealing with the complete step, which is represented by the following code: <li class="i ...

Display immersive full-screen overlays that encompass the entire vertical space without the need for scrolling

Recently, I ran into a challenge while attempting to create a CSS print style-sheet. The issue arose when I tried to print a full-screen overlay containing scrollable content. Only the content that was currently displayed would show up in the printed ver ...

Choosing and transferring the table data to be shown in the pop-up box

Having encountered an issue with a popup trigger placed inside a td element, I am seeking advice on how to pass table data into the popup window. Unfortunately, the main popup window was positioned outside the while loop, resulting in multiple instances of ...

When a user clicks on a button, AJAX and jQuery work together to initiate a setInterval function that continually

Currently, I have two scripts in place. The first script is responsible for fetching a specific set of child nodes from an XML file through AJAX and using them to create a menu displayed as a list of buttons within #loadMe. What's remarkable about thi ...

Unable to retrieve the following element in a JavaScript array

I am a beginner in JavaScript and I am attempting to access the next element of an array using an onclick function but so far I have not been successful. var i, len; function quiz() { var quiz_questions = [ "who is the founder of Fa ...

Having trouble with the redirection of my Django registration page

I have encountered an issue while creating a registration page for my Django project. The problem arises when I compile the registration form as it is trying to navigate to a path where it repeats 'users/register'. Instead of going to 'local ...