gpt4 book ai didi

html - CSS3 Grid-gap 不适用于 iphone

转载 作者:塔克拉玛干 更新时间:2023-11-02 22:06:51 24 4
gpt4 key购买 nike

我正在使用 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;
}
}

当我最小化页面时,间隙正常,但当我在 iPhone SE 上查看时,网格间隙不起作用?为什么会这样?

希望你能理解我的问题

提前致谢。

最佳答案

查看此页面 ( 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com