【发布时间】:2021-10-24 21:05:13
【问题描述】:
我制作了一个移动导航,并且菜单在 chrome / edge 开发工具中的显示方式与在实际移动设备上的显示方式不同。 (见下文)。我在开发工具中使用过所有手机,主要是 iPhoneX。我在 iPhone XS max 和 iPhone 12 Pro max 上测试过。
开发工具 Dev Tools 移动设备 Mobile Devices
.nav {
display: none;
flex-direction: column;
width: 100%;
padding: 10px 0;
text-align: center;
line-height: 40px;
background-color: $darker-blue;
border-radius: 5px;
margin-top: 125px;
position:absolute;
}
<!-- HEADER SECTION -->
<header class="header">
<div class="container">
<div class="header-content">
<div class="header-img">
<a href="index.html"><img src="img/cglogo.png" alt="Logo" height="50px" width="50px"> </a>
</div>
<div class="nav" id="nav">
<a href="index.html" class="nav-item active"> Home</a>
<a href="portfolio.html" class="nav-item"> My Work</a>
<a href="blog.html" class="nav-item"> Blog</a>
<a href="contact.html" class="nav-item"> Contact</a>
</div>
<a href="javascript:void(0);" class="icon" onclick="myFunction()">
<i style="color: #e7e7e7;" class="fa fa-bars fa-2x" id="bars"></i>
</a>
</div>
</div>
</header>
【问题讨论】:
-
能否添加代码?您使用过哪种移动设备?
-
指定您使用过的手机设备,并告诉我们您在开发工具中使用过哪款手机
-
@MetropolisCZ 已更新代码。谢谢
-
@AsfandyarKhan 已更新。谢谢