that the spirit
now let us take t step by step
when you set the sidebar to grid it tell the browser that this sidebar is grid so it only affect that sidebar and it’s child it has no effect on it’s parent or sibling
and the sidebar child will be displayed based on the grid setting you set like 2 coloum 1 row or auto or whatever you set but that position is related to what ? and another question where the sidebar itself will be displayed?
the answer it will be related to what sidebar already are for example if side bar was in the right side on the screen then sidebar will stay there but the child of it will arranged itself on that right side based on attribute you set for the grid
so the side will stay on right cause the grid on the sidebar affect it’s child not it’s sibling or parent
but what we want to achive here we want to make the side bar to display under the main (more precisly in our case under the article ) in that case so we need to check the common parent of article and the aside which we found it’s the main
so if i removed the main selector and moved it to the media selector like bellow
@media screen and (min-width: 43em) {
main {
display: grid;
grid-template-columns: 3fr 1fr;
column-gap: 20px;
}
}
i used the em as it better to make it more responsive than to get it to px (remove your main selector from non media area)
so it tell the browser to display the sidebar as next to article is size is above this 43em and if not then there no grid so what the layout will be used it will be using the box layout which make the sidebar to display below the article as it block element
so think of the nav in some way to make it show up under the title in smaller screen size
let me know if my explanation is not good or if i should explain it in a better way
at first layout and how many layout interact with each other could be confusing at the beginning but the more you played with it the more it become fun and you will master it
and have a nice day