Why doesn't my div span across its child div?


here is the code in question: GitHub - AnnaDrewing/breakout-game
Page: Breakout Game

I’m leaving the ugly beige color in the background to show the problem. I would like the color to contain the game field as well, and that, I believe, should be the case now.
The div .game does contain the .grid, yet also in the inspector the class .game seems to only be on top.
I do not understand what can be the problem here. I double and triple checked the divs’ opening and closing tags and I don’t have any other ideas what could the problem be.

Thanks in advance for the help.

can you use code pen or something that ppl can see what you working on instead of cloning a git and opening in a personal computer

I posted it as a git page as well. Now the link is there too.

your grid class has a position: absolute its container is not part its parent

1 Like

I see. Thank you for the help.

your new Block array is hard coded, the data structure you need should be to draw as many blocks as you want like new Block(36), with CSS you make a 5x3 grid or w.e and then with js check the blocks[i].bottomLeft[0]

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.