can't get the 2nd section into a grid format

The grid just doesnt look right. Need the headers above the text and the text below like a column format https://codepen.io/MD-2016/pen/YzjjezZ
MD
CodePen
CRL final
...
27 Replies
MD
MDOP3y ago
trying to this spaced out better and things aren't clumped
Myndi
Myndi3y ago
Which one specifically? The 3 cards section? "Mobile first", etc?
MD
MDOP3y ago
yeah trying to get it like this
MD
MDOP3y ago
Myndi
Myndi3y ago
Myndi
Myndi3y ago
Like this?
MD
MDOP3y ago
yes 🙂 just need more gap spacing
Myndi
Myndi3y ago
I just did this.
.first .container {
display: flex;
}

.first-item {
text-align: center;
}
.first .container {
display: flex;
}

.first-item {
text-align: center;
}
MD
MDOP3y ago
🤦🏻
Myndi
Myndi3y ago
Grid approach.
.first .container {
display: grid;
grid-template-colums: repeat(auto-fit, minmax(200px, 1fr));
}
.first .container {
display: grid;
grid-template-colums: repeat(auto-fit, minmax(200px, 1fr));
}
MD
MDOP3y ago
that's what I got was grid just no auto fit and min max
Myndi
Myndi3y ago
Myndi
Myndi3y ago
I think you might be targeting the wrong parent. Might get dizzy, but make sure you're aiming for the correct parent.
MD
MDOP3y ago
how do you get the spacing between the other sections and header and paragraph of this section? I think a row gap can do the header and paragraph but idk about the others if thats padding or margin
Myndi
Myndi3y ago
Myndi
Myndi3y ago
Like this?
MD
MDOP3y ago
yeah that's my goal
Myndi
Myndi3y ago
.first .container {
background-color: #e0dede;
display: flex;
padding: 3rem;
justify-content: between;
gap: 1em;
}

.first-item {
text-align: center;
padding: 1em;
}
.first .container {
background-color: #e0dede;
display: flex;
padding: 3rem;
justify-content: between;
gap: 1em;
}

.first-item {
text-align: center;
padding: 1em;
}
MD
MDOP3y ago
defeated again by padding and margins
Myndi
Myndi3y ago
Padding on the container to push the child inside, and some padding on the child for consistency, but could be just playing around for the right values.
MD
MDOP3y ago
indeed I did the first version using flex only I wanted to see how well grid does with it any tips on getting the margin and padding right? like any visual tool that could help besides just dev tools?
Myndi
Myndi3y ago
Just eye, try different values. 0.5em > 0.75em > 1em > etc. It's pretty common to use certain padding/margin values.
MD
MDOP3y ago
I know kevin suggests doing outlines with borders
Myndi
Myndi3y ago
Outlines with borders?
MD
MDOP3y ago
yeah outline: 2px solid red;
Myndi
Myndi3y ago
You mean, emulate a border with outline?
MD
MDOP3y ago
yeah

Did you find this page helpful?