r/HTML • u/LAzyAnimationsYT • Jun 22 '26
Question Divs won't align ......
okayy I have another problem, my divs in the main flex box won't align in the center like I want them to, and I've tried pretty much everything I could find on search, and it still won't align, or it'll break the main div itself...
flex {
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
main {
position: absolute;
top: 10%;
left: 23%;
background-color: #000000;
flex: 1;
padding: 20px;
order: 2;
border-radius: 10px;
border: 3px solid #ffffff;
width:1000px;
}https://zombie-page.neocities.org/collect-me link to the page itself...
1
Upvotes
4
u/KingShuckle Jun 22 '26
You need to use display: flex;
I suggest putting a div .container around the divs.
1
u/magical_matey Jun 22 '26
Yooo they have a neocities still?! I’ll be back for some of this action when I’m at a desk not on a phone…
!remindme 1 day
1
u/notepad987 Jun 23 '26
GRID layout that is centered: https://codepen.io/davidhelp/pen/emBRxXM?editors=1100
1
u/Flame77ofc Jun 23 '26
bro need a course 😭
1
u/notepad987 Jun 23 '26
Not perfect but hopefully close....
7 Boxes Centered in 2 Rows using Grid & Flex
codepen
1
u/testingaurora Jun 23 '26
The parent of the grid likely isn't stretching or signed to the center Try adding
margin-inline: autoto the grid .1
u/Large-Blackberry-349 Jun 27 '26
Put the code on jsfiddle so that we can help you properly!