-2

this is what i would like to get:

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

what I have done:

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] As you can see there is no error in this code, my initial problem is due to the improper installation of Firefox on my computer. I didn't know it when I asked this question.
I can't delete it (due to one answer with upvotes)

Mister Jojo
  • 20,093
  • 6
  • 21
  • 40
  • Does this answer your question? [Using flex to achieve two rows and one column layout](https://stackoverflow.com/questions/53707051/using-flex-to-achieve-two-rows-and-one-column-layout) – Awais Feb 07 '20 at 14:39

1 Answers1

4

You need to add a height setting for the container, otherwise the items won't wrap, but stack, since the container height by default adjusts to the contents:

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>
Johannes
  • 64,305
  • 18
  • 73
  • 130