I am following a mobile-first approach with 3 containers that need to be displayed in 3 different layouts as shown in the image below:
https://i.sstatic.net/UjKNH.png
The closest CSS implementation I have achieved so far is this:
HTML:
<header>...</header>
<aside>...</aside>
<main>...</main>
CSS
@media screen and (max-width: 480px) {
header,
main,
aside { width: 100%; }
}
@media screen and (max-width: 960px) {
main { float: left; width: 60%; }
aside {float: right; width: 40%; }
}
@media screen and (min-width: 961px) {
header: { float: left; width: 60%; }
}
Unfortunately, in the first layout, the aside container appears right below the header instead of below the main container. Is there a way to achieve this using CSS only? I'm also open to exploring JavaScript workarounds. Thank you!