How can I use CSS to position a <div>
element with the class js-form-type-managed-file above a <table>
element?
I tried using flexbox
and order
but it didn’t work.
details {
display: flex;
flex-direction: column;
width: 1500px;
height: 1000px;
}
table {
width: 1200px;
height: 100px;
background: red;
order: 2;
}
.js-form-type-managed-file {
width: 1200px;
height: 100px;
background: yellow;
order: 1;
}
<details>
<summary></summary>
<div></div>
<div></div>
<table class="responsive"></table>
<div class="js-form-type-managed-file"></div>
</details>
3
Answers
The details component does not allow you to do this.
You should wrap the 2 divs like this:
Then use this CSS:
Your CSS code appears to be right, but the details element—not just the div inside it—needs to have the display: flex property added. This will let you to modify the order of the child elements using the order attribute.
display: flex
has no effect on thedetails
element. So, theorder
property is useless, as flex properties are not in effect.Either use JavaScript (if you can’t change the mark-up) or wrap the items inside
details
in a container, then use flex.