CSS stay and fit into the grid

Hello, How can I do that to every item stay in ther grid place and fit in it. Menu in menu,Image in img, Buttons in buttons. On mobile, tablet, 4k screen, so it have to be responsive. All centered. Here is the example https://codepen.io/lanszelot/pen/ZERQrqR
12 Replies
b1mind
b1mindβ€’3y ago
What you are doing wont work. By setting the parent grid to relative and pos absolute and using grid-area. What you want is subgrid to do this and its not fully supported yet. So to use grid-areas they need to be children of teh grid parent (without pos: absolute)
lanszelot
lanszelotOPβ€’3y ago
First of all, thanks for your answer. How can I do that? children of the grid parent?
b1mind
b1mindβ€’3y ago
Kevin Powell
YouTube
The secret to mastering CSS layouts
Deep dive this topic, and much more, in my course CSS Demystified: https://cssdemystified.com/?utm_campaign=css-relationships&utm_source=youtube&utm_medium=description πŸ”— Links βœ… Why flex items with padding aren’t the same size (it’s an article, not video, sorry!): https://youtu.be/fm3dSg4cxRI βœ… Flexbox or grid - How to decide? https://youtu.b...
lanszelot
lanszelotOPβ€’3y ago
the width cannot be auto, because mobile can be landscape, and portrait mode so I have to use orientation, where I have to setup width
b1mind
b1mindβ€’3y ago
That video was to clear up child/parent relationships
lanszelot
lanszelotOPβ€’3y ago
I do not understand it I am a beginner. I not study it. I just do it for fun only
b1mind
b1mindβ€’3y ago
Its a very important concept you should learn to be able to use CSS correctly
lanszelot
lanszelotOPβ€’3y ago
but if I cannot understand what he explain in the video I cannot see the example behind his head what he do he explain not for beginners and I cannot see what I have to see. What he does with the lines
b1mind
b1mindβ€’3y ago
Seems to me like you didn't try and I can't explain it better than Kevin so cheers. gl
lanszelot
lanszelotOPβ€’3y ago
ok, thanks πŸ™‚
b1mind
b1mindβ€’3y ago
maybe someone with more time will offer help, or if you frame/show what you are expecting the result to be (a sketch or img of the design)
lanszelot
lanszelotOPβ€’3y ago
Hello, I made it. I used orientation everywhere and vh vw. πŸ™‚
Want results from more Discord servers?
Add your server