免责声明:我不是经验丰富的网页设计师。
我一直在玩网格并为不同的屏幕尺寸设置这个模型,但我无法理解为什么div内容区域比其内部的嵌套面板包网格高得多? (我在Chrome上测试)。
根据铬检查员的说法,只有当内容区域超过647px宽时才会增大。
我只想了解空间出现的原因?
if ($userStatus) {
// user existed
// So log him to main page
$json['success'] = 1;
$json['message'] = 'Access Granted';
$json['usertype'] = 'Client';
echo json_encode($json);

body {
margin: 1em;
}
.sidebar {
grid-area: sidebar;
}
.sidebar2 {
grid-area: sidebar2;
}
.content {
grid-area: content;
}
.header {
grid-area: header;
}
.footer {
grid-area: footer;
}
.wrapper {
background-color: #fff;
color: #444;
}
.wrapper {
margin: auto;
display: grid;
grid-gap: 1em;
grid-template-areas: "header" "sidebar" "content" "sidebar2" "footer"
}
@media only screen and (min-width: 500px) {
.wrapper {
grid-template-columns: 20% auto;
grid-template-areas: "header header" "sidebar content" "sidebar2 sidebar2" "footer footer";
}
}
@media only screen and (min-width: 600px) {
.wrapper {
grid-gap: 20px;
grid-template-columns: 120px auto 120px;
grid-template-areas: "header header header" "sidebar content sidebar2" "footer footer footer";
max-width: auto;
}
}
.box {
background-color: #444;
color: #fff;
border-radius: 5px;
padding: 0.5em;
font-size: 150%;
}
.header,
.footer {
background-color: #999;
}
.sidebar2 {
background-color: #ccc;
color: #444;
}
.panelwrap {
display: grid;
padding: 0.5em;
grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
grid-auto-rows: minmax(auto, auto);
grid-gap: 0.5em;
}
.panel {
background-color: #fff;
color: #555;
border-radius: 5px;
padding: 0.5em;
}
.tall-panel {
grid-row-end: span 2;
}
.wide-panel {
grid-column-end: span 2;
}