My flexbox doesn't seem to be working properly. I'm attempting to utilize the column layout on a form element

my desired output looks like:

┌─────┐┌─────┐
│  A  ││     │
└─────┘│     │ 
┌─────┐│  B  │ 
│  C  ││     │
└─────┘│     │
       └─────┘

this is what I have tried:

form {
  display        : flex;
  flex-direction : column;
  flex-wrap      : wrap;
  height         : 14em;
  }
fieldset { 
  display : block;
  margin  : 1em .6em;
  }
fieldset:nth-child(2) {
  order      : 2;
  flex-basis : 10em;
  }
<form action="" id="my-form">
  <fieldset>
    <legend> -A- </legend>
    <input type="text">
  </fieldset>
  <fieldset>
    <legend> -B- </legend>
    <input type="text">
  </fieldset>
  <fieldset>
    <legend> -C- </legend>
    <input type="text">
  </fieldset>
</form>

[edit] I can confirm that there are no errors in this code. The issue I encountered was actually due to a faulty installation of Firefox on my system. This information came to light after posting the initial question.
I am unable to delete the question as it has received an answer with upvotes.

Answer №1

In order for the items to wrap instead of stack in the container, you must include a height setting for the container element:

form {
  display: flex;
  flex-direction: column;
  flex-wrap:wrap;
  height: 10em;
}

fieldset { 
  display:block;
  margin-top: 1em;
  width:12em; 
}
 fieldset:nth-child(2) {
  flex:1;
  order:2;
  height:20em;
 }
<form action="" id="my-form">
  <fieldset>
    <legend> -A- </legend>
    <input type="text">
  </fieldset>
  <fieldset>
    <legend> -B- </legend>
    <input type="text">
  </fieldset>
  <fieldset>
    <legend> -C- </legend>
    <input type="text">
  </fieldset>
</form>

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

Is it possible to change the ajax src attribute without initiating a new request?

My goal is to create an iframe using a system that utilizes HTTP authentication. Below is the code I am currently working with: <iframe id="dashboard"></iframe> <script type="text/javascript"> $.ajax( ...

What steps can I take to stop my browser from displaying the "waiting for MyHostName" message while performing an ajax Post/Get operation?

Whenever I access a website using Chrome, a message appears in the status bar saying "Waiting for MyHost name" along with an Ajax Loader circle in the browser tab. Here is a javascript function that I am working with: function listen_backend_client_reques ...

Issue encountered when attempting to create a PDF from HTML using the iTextSharp dll: Not functional

I'm attempting to create a PDF file from an HTML string. I've attempted using   for spacing between words, but unfortunately it is not displaying properly in iTextSharp. Instead of adding space between the words, the PDF is showing them as o ...

Adding and adjusting the size of different DIV elements within a shared area

Looking to create a dynamic bar with the ability to add multiple child DIVs (similar to this: https://i.stack.imgur.com/tdWsq.jpg). Utilizing jQuery, jQuery UI, Bootstrap, and various plugins. The structure for the div (or span) system could be structured ...

Does CSS media query "@media only screen" only work when I am resizing the window?

I recently encountered an issue with the code found on this website (the repository can be viewed on Github here): @media only screen and (max-width: 600px) { img {width: 100%; height: 100%; margin: 0; padding: 0; } a.box { width: 100%; pa ...

Get the content from a webpage, find and calculate the total count of div elements with a specific class, and display that number

Greetings everyone, I've run into a bit of a roadblock. My goal is to create a basic script that can count the number of servers currently running on this map by scraping the webpage, calculating the divs with the class ".row ark_srv1", and then displ ...

Tips for organizing a dashboard design with Bootstrap

I am looking to design a dashboard using the Bootstrap grid system. Here is the layout I have in mind: https://i.sstatic.net/cqWP5.jpg What would be the optimal way to structure this in the HTML file? Would a layout of 5 rows and 2 columns work best? Th ...

The Salvattore grid became unresponsive and malfunctioned as soon as AngularJS was integrated

After incorporating AngularJS into my project, Salvatore grid suddenly ceased to function and stopped rendering properly. I am interested in utilizing the ng-repeat feature to iterate through all items and showcase them within the Salvatore grid layout. ...

What is the best way to activate the default action/event of an HTML link (anchor element)?

Is there a way to programmatically trigger the default action of an HTML link using JavaScript or jQuery? Essentially simulating a user click on the link. Simply using .click() does not seem to do the trick. $('#alink').click(); // nothing happ ...

Modify the background color of a particular row in a dynamic table with the help of AngularJS

My dynamic table consists of the following: <table id="thetable"> <tr> <th class="th2">&nbsp;&nbsp;Id&nbsp;&nbsp;</th> <th class="th2">&nbsp;&nbsp;Attivo ...

Guide to connecting an object's attribute with an Angular2 form element using select

Currently facing an issue with angular forms. I am attempting to set up a form that retrieves data from a mongo collection and presents it using the <select> directive. Utilizing a FormBuilder to set it up as shown below: ngOnInit() { this.addFo ...

The video is not extending to the full width of the container

Looking at the image I've attached, it's clear that the video is not covering the full width as desired. Can someone pinpoint where I'm making a mistake? Here is the image for reference: Image of the div and video Here's the snippet of ...

Unable to display a Google map within a webview when viewing a local HTML file

I am currently working with a local HTML file called basicmap.html that includes the following code: <!DOCTYPE html> <html> <head> </head> <body> <div id="map"></div> <script> ...

Can you provide a guide on how to retrieve an HTML file using JSON?

There is a problem with fetching files in different formats. Specifically, I want to retrieve an HTML file that needs to be embedded in an iFrame. Currently, my AJAX request only retrieves SWF files. Is there a way to call and fetch the HTML file instead ...

Efficiently formatting text in a div container

How can I ensure that the text within a span is word-wrapped inside a div? https://i.sstatic.net/W691d.png Here is the code snippet: <div class="col-xs-6 choice btn btn-default" > <span class="pull-left">(Kepala) Bagian Purchasing (not lis ...

What is the best way to display identical dropdown menus for multiple div elements on a single page?

I am new to asp.net and programming in general (this is my first question so please be patient with me). I have encountered an issue with my initial project. The page contains multiple tiles, each following the same style. I want to include a dropdown men ...

Updating a column in a SQL Table via an Ajax request

I am attempting to store the on or off value from a form into an SQL database by calling a JS function with an AJAX request that sends it to a PHP page for processing. I seem to be facing some issues with my code and could really use some assistance as the ...

Did my code effectively block an XSS attack?

Recently, I was informed that my website has vulnerabilities to XSS attacks. In an effort to improve security, I have implemented the htmlspecialchars method as a preventive measure. Here is the function I created: function _e($string){ return htmlsp ...

Coloring weeks in fullcalendar's two-shift calendar

Can FullCalendar create a calendar with alternating colors for odd and even weeks? Visit the FullCalendar demos here For example, see image below: https://i.sstatic.net/D5qza.png ...

Tips for making your inner content as wide as possible

I'm currently working on developing collapsible tables, where an outer and inner table are displayed for every row that is clicked. This is the code I have implemented: HTML: <table class="table outerTbl mb-0"> <thead> <t ...