Why my flex box can't align items vertically

12 Replies
ἔρως
ἔρως14mo ago
yeah, nobody is going to read 8.19kb of code and guess which flex isnt working can you shorten it to the minimum reproducible example and put it in codepen or jsfiddle or something?
Giveth
GivethOP14mo ago
let me try
missymae
missymae14mo ago
just guessing - in your rows style
flex-direction: column;
justify-content: center;
flex-direction: column;
justify-content: center;
You change flex-direction, so the justify and align axis switch. Try using align-items there.
Giveth
GivethOP14mo ago
https://jsfiddle.net/Giveth_23/nuv74e1m/1/ I left a comment in the css section where there is justify content
Edit fiddle - JSFiddle - Code Playground
Test your JavaScript, CSS, HTML or CoffeeScript online with JSFiddle code editor.
Giveth
GivethOP14mo ago
I did that it still did not work. The flex box works. Let me explain abit more. If you set flex-direction: row; align-items: center; Then it works perfectly fine but the flex item inside the parent would look disorganised and that is not want i want it. But, when i set flex-direction flex-direction: column; align-item: center; they just align them horizontally but not vertically I do not know the cause or why the flex items are acting in that manner
ἔρως
ἔρως14mo ago
for your columns with the class .row1, .row2 and .row3, just add this:
flex-basis: 33.3%;
align-items: center;
flex-basis: 33.3%;
align-items: center;
and remove the width
ἔρως
ἔρως14mo ago
No description
ἔρως
ἔρως14mo ago
also: DO NOT USE BORDERS TO SHOW THE LAYOUT it changes the layout, making them absolutely useless use outlines
ἔρως
ἔρως14mo ago
to tighten it up, also use a text-align: center:
No description
ἔρως
ἔρως14mo ago
i presume this is what you wanted but honestly, why don't you use grid for this?
Giveth
GivethOP14mo ago
Thanks for the tip I used borders coz that is how i do it when am creating the layout. I will learn how to use grid 👍
ἔρως
ἔρως14mo ago
the problem with borders is that you aren't working with the real area that the elements take you're working with the size plus/minus a few pixels, which will lead to layout differences
Want results from more Discord servers?
Add your server