CSS3 Grid-gap无法在iphone上运行

时间:2017-10-26 04:32:57

标签: html ios css iphone css3

我正在使用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上检查时,网格间隙不起作用?为什么会这样?

我希望你能理解我的问题

提前致谢。

1 个答案:

答案 0 :(得分:0)

请参阅此页面(https://caniuse.com/#search=grid),进入&#34;已知问题&#34;并看看它对野生动物园的看法:

  

Safari还不支持使用网格进行内在和外在的大小调整   grid-template-rows等属性