I'm trying to adapt Flexible Holy Grail layout shown at https://css-tricks.com/snippets/css/css-grid-starter-layouts/ to have resizable header, footer and sidebars. One constraint I have is that that the sidebars must all start off at an absolute width given in pixels. The user can then resize them horizontally using the mouse. Similarly the header/footer must start at an absolute height, and also be resizable vertically.
I've tried to use the solutions given here, but they seem to rely to relative sizing, so I lose the ability to provide an exact starting width.
This CodePen shows what I've managed so far. Do I have to somehow convert the absolute initial sizing into relative sizing, or is there another way?
.grid {
display: grid;
grid-template-columns: 1fr 2fr 1fr;
grid-template-rows: repeat(3, 100px);
grid-gap: 1em;
}
header, footer {
overflow: auto;
resize: vertical
}
aside {
overflow: auto;
resize: horizontal;
}
header,aside,article,footer {
background: #eaeaea;
padding: 1em;
}
header, footer {
grid-column: 1 / 4;
}
/* Demo Specific Styles */
body {
margin: 0 auto;
max-width: 56em;
padding: 1em 0;
}
.grid > * {
display: flex;
align-items: center;
justify-content: center;
}
<div class="grid">
<header>
Header
</header>
<aside class="sidebar-left">
Left Sidebar
</aside>
<article>
Article
</article>
<aside class="sidebar-right">
Right Sidebar
</aside>
<footer>
Footer
</footer>
</div>