My main question there is in the title, here I will ask my question in the following example:
CSS and HTML codes:
*{
margin: 0;
padding: 0;
}
.panel{
display: grid;
grid-template-columns: 250px 1fr;
grid-template-rows: 80px 1fr;
background-color: aqua;
height: 100vh;
gap: 15px;
}
.panel-a{
background-color: brown;
}
.panel-b{
background-color: antiquewhite;
}
.panel-c{
background-color: blueviolet;
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Test Grid</title>
<link rel="stylesheet" href="temp-style.css"/>
</head>
<body>
<div class="panel">
<div class="panel-a">A</div>
<div class="panel-b">B</div>
<div class="panel-c">C</div>
</div>
</body>
</html>
the result of these codes are normally! But when I add the grid-row: 1/2;
code to panel-b
class, an unexpected thing happens:
Item B goes to the first column! Why?! Have we changed the grid-column value? NO!! so why goes to the first column?
5