It is my first attempt us use responsive design using grid templates, following some example code I found. However my elements just use one grid cell, even if multiple contiguous cells use the same name.
Consider this primitive test (derived from the real code):
<html>
<head>
<title>Test</title>
<style>
@media screen {
.grid-1 { /* main grid */
display: grid;
grid-template-areas:
'main main'
'opt1 opt2'
'opt3 opt3'
'subm ...';
gap: 10px;
}
.grid-1 * {
/* adjust box sizing */
margin: 0;
box-sizing: border-box;
background-color: #ccc;
}
}
@media screen and (width < 60rem) {
.grid-1 {
grid-template-areas:
'main main'
'opt1 opt1'
'opt2 opt2'
'opt3 opt3'
'subm ...';
}
}
</style>
</head>
<body>
<div class="grid-1">
<span grid-area="main">Main</span>
<span grid-area="opt1">Options 1</span>
<span grid-area="opt2">Options 2</span>
<span grid-area="opt3">Options 3</span>
<span grid-area="subm">Submit</span>
</div>
</body>
</html>
Debugging in Firefox the grid is shown like this (I added the background color in CSS for illustration after having made the screenshot):
(in the original code the <div> is a <form>, and the <span>s are `s)
Also note that adding more text into the elements does not change the assignment to grid cells.
Probably some beginner's mistake, but I don't get it.
