I have an element with the #text inside a flex container and I want to position something absolutely beneath it:
How can I ensure that it does not affect the positioning of its siblings in the flex layout?
#container{ display: flex; align-items: center; justify-content: space-around; flex-direction: column; position: relative; width: 95vw; height: 95vh; border: 1px solid black } #text{ font-size: 13px; width: 50vw; text-align: justify; } #absolute{ position: absolute; bottom: 5px; left: calc(47.5vw - 25px); width: 50px; text-align: center; color: red; }
It seems that the #text is slightly off-center within its parent, and I would like it to be perfectly vertically centered without modifying:
The node tree.
The already defined flex properties (like justify-content).
Edit :
I came across another question related to this issue, but the suggested solution did not work for me. Check it out here: Absolute positioned item in a flex container still gets considered as item in IE & Firefox
It appears to be a bug specific to Firefox and IE. (I am currently using Firefox 47, where the issue persists, whereas it works fine on Chromium.)
Final Edit :
After further research, I found several similar questions:
Absolute positioning interfering with flexbox positioning in Firefox
Absolutely positioned flex item not being removed from normal flow in Firefox
Flexbox in Firefox: Items are not lined up properly
Answer by @Oriol Exclude element with fixed positioning from justify-content in flex layout
For more information, visit Bugzilla.