簡體   English   中英

CSS3 Grid-gap 不適用於 iPhone

[英]CSS3 Grid-gap not working on iphone

我正在使用 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 上檢查時,grid-gap 不起作用? 為什么呢?

我希望你能理解我的問題

提前致謝。

請參閱此頁面 ( https://caniuse.com/#search=grid ),進入“已知問題”並查看它對 safari 的說明:

Safari 尚不支持使用 grid-template-rows 等網格屬性進行內部和外部大小調整

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM