Why my flex box can't align items vertically

12 Replies
ἔρως
ἔρως7mo 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
Giveth7mo ago
let me try
missymae#2783
missymae#27837mo 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
Giveth7mo 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
Giveth7mo 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
ἔρως
ἔρως7mo 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
ἔρως
ἔρως7mo ago
No description
ἔρως
ἔρως7mo ago
also: DO NOT USE BORDERS TO SHOW THE LAYOUT it changes the layout, making them absolutely useless use outlines
ἔρως
ἔρως7mo ago
to tighten it up, also use a text-align: center:
No description
ἔρως
ἔρως7mo ago
i presume this is what you wanted but honestly, why don't you use grid for this?
Giveth
Giveth7mo 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 👍
ἔρως
ἔρως7mo 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
More Posts
Feedback on responsiviness and javascript useHello, I almost finisch a FEM challenge and I wonder how I can improve the responiviness and my Can you provide guidance on setting up a container that uses an SVG in a different shape?Hi , i was figuring this out how i can make this container with different shaped svg on left corneHow to setup the initial layout on a page - where do I put containers?If you were building a layout from scratch, how would you do it, and where would you put containers?how to fix background breakingthis is my portfolio. i made a absolute background in a self closing div inside a section set to relAny idea how to implement the book-open effecthttps://twitter.com/TGUPJ/status/1666978946108235780?s=20Where do I put the font face?I was just trying @font-face {} with a CSS file, I was just wondering where this is usually kept at.Problem positioning content with subgridGuys, I'm having a problem positioning the content of my first line. As you can see, I positioned thGithub trials and tribulations: Accessing non-'main' branches of a pulled repo locallyI initialized a local github repository and then performed a 'git pull' of an existing online reposiDoes anyone know why Kevin used _index.scss instead of index.scss when setting up @use and @forward?https://www.youtube.com/watch?v=CR-a8upNjJ0&t=242s - this is the exact place where he talks about thCSS Custom Properties for every ComponentI'm working on a project in Astro and using Svelte to handle all UI components. This project is gett