我正在使用 CSS 制作模板,一切正常,但网格间隙在 iPhone 上不起作用。这是我目前所拥有的:
<div class="grid">
<h1 class="page-title">
<?php echo $username; ?>
</h1>
<header class="header">
Reviewed
<?php
$sql = $mysqli->query("SELECT `id` FROM `users` WHERE `username`='$username'");
$result = $sql->fetch_assoc();
$result = $result['id'];
$sql = $mysqli->query("SELECT COUNT(rating) FROM `reviews` WHERE `userid`='$result'");
$result = $sql->fetch_assoc();
echo " " . $result['COUNT(rating)'] . " ";
if ($result['COUNT(rating)'] == 1) {
echo "Movie";
} else {
echo "Movies";
}
?>
</header>
<main class="main-content">
Test
</main>
<aside class="sidebar">
Sidebar
</aside>
<footer class="footer">
Footer
</footer>
</div>
CSS:
.grid {
margin: 15px;
display: grid;
grid-template-columns: 1fr 1fr;
grid-template-rows: 1fr 1fr 1fr 1fr 1fr;
grid-template-areas:
"index-title index-title"
"index-header index-header"
"index-main-content index-main-content"
"index-sidebar index-sidebar"
"index-footer index-footer";
grid-gap: 10px;
}
.page-title {
grid-area: index-title;
text-align: center;
}
.header {
grid-area: index-header;
border: 1px black solid;
font-size: 20px;
text-align: center;
}
.main-content {
grid-area: index-main-content;
background-color: green;
}
.sidebar {
grid-area: index-sidebar;
background-color: yellow;
}
.footer {
grid-area: index-footer;
background-color: purple;
}
@media screen and (min-width: 1062px) {
.grid {
margin: 15px;
display: grid;
grid-template-columns: 1fr 500px 500px 1fr;
grid-template-rows: 1fr 1fr 2fr 1fr;
grid-template-areas:
". index-title index-title ."
". index-header index-header ."
". index-main-content index-sidebar ."
" .index-footer index-footer .";
grid-gap: 10px;
}
}
当我最小化页面时,gap 起作用了,但是当我在 iPhone SE 上检查时,grid-gap 不起作用?为什么会这样?
希望你能理解我的问题
提前致谢。
查看此页面 (https://caniuse.com/#search=grid),进入“已知问题”并查看它对 safari 的描述:
Safari does not yet support intrinsic and extrinsic sizing with grid properties such as grid-template-rows
关于html - CSS3 Grid-gap 在 iphone 上不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/46945906/
欢迎光临 OGeek|极客世界-中国程序员成长平台 (http://jike.in/) | Powered by Discuz! X3.4 |