html - 移动设备上不显示主菜单(纵向)
问题描述
所以我仍在学习用于移动设备的 css / html。我有一个在桌面上看起来不错的网站。当您在移动设备上将其拉起时,菜单消失了。如果您进入美化模式,将出现菜单。为什么有任何帮助?
菜单代码。
<div class="menu_block ">
<div class="container_12">
<div class="grid_12">
<nav class="horizontal-nav full-width horizontalNav-notprocessed">
<ul class="sf-menu">
<li <a href="index.php"><img src="images/logo.png" alt="wake up rentals"></a></li>
<li class="current"><a href="index.php">Home</a></li>
<li><a href="rental.php">Rentals</a></li>
<li><a href="lakes.php">Lakes</a></li>
<li><a href="Register.php">Rent Now</a></li>
<li><a href="FAQ.php">FAQ's</a></li>
<li><a href="Login.php">Login</a></li>
<li><a href="Contact.php">Contact Us</a></li>
</ul>
</nav>
<div class="clear"></div>
</div>
<div class="clear"></div>
</div>
</div>
菜单块 CSS
.menu_block {
z-index: 999;
position: relative;
background: url(../images/menu_bg.png) 0 0 repeat-x #d8d8db;
padding: 12px 0 11px;
}
.menu_block nav {
position: relative;
font-family: 'Marvel', sans-serif;
}
nav>.sf-menu {
z-index: 990;
text-align: center;
position: relative;
}
nav{ position:relative;padding: 0px 0 0 0;}
.sf-menu ul {position:absolute;top:-999px; display:none;/* left offset of submenus need to match (see below) */}
.sf-menu>li {
display: block;
position: relative;
display: inline-block;
font-size: 24px;
line-height: 20px;
}
.sf-menu>li>ul>li {
float: none;
position: static;
}
.sf-menu>li+li {
margin-left: 27px;
}
.sf-menu>li>a{
font-weight: bold;
text-align: center;
color: #313030;
display: block;
padding: 9px 25px;
}
.sf-menu>li.sfHover>a, .sf-menu>li.current>a, .sf-menu>li>a:hover {
color: #000;
background-color: blue;}
.sf-menu>li>a.sf-with-ul:after {
position: absolute;
content: '';
left: 50%;
margin-left: -3px;
width: 5px;
background: url(../images/arrows.png) 0 0 no-repeat;
height: 4px;
bottom: 10px;
pointer-events: none;
z-index: 999;
display: block;
}
.sf-menu>li>ul>li>a.sf-with-ul:after {
content: '';
font-family: 'FontAwesome';
position: absolute;
width: 5px;
font-size: 15px;
line-height: 13px;
font-weight: normal;
right: -15px;
color: #fff;
bottom: 3px;
pointer-events: none;
z-index: 999;
}
移动菜单块
@media only screen and (max-width: 767px) {
.menu_block {
float: none !important;
padding: 20px 10px 25px !important;
clear: both;
min-height: 0px;
border: none;
}
.menu_block nav {
border: none !important;
float:none !important;
font:12px/15px Arial, Helvetica, sans-serif;
text-transform:uppercase;
color:#927c67;
margin: 0 auto;
padding-left: 0 !important;
}
header nav ul {
border: none;
}
.sf-menu {
display:none !important;
float: none;
}
#mm0 {
font:12px/15px Arial, Helvetica, sans-serif;
color:#202020;
width:100%;
margin: 0 auto;
float: none;
outline: none;
border:2px solid #fff;
}
}
我不确定您是否需要更多类似 container_12 和 grid_12 的代码。其中有很多行代码。并且不想添加很多不需要的信息。如果您认为需要它们,我可以发布它们。
Container_12 / 一些 grid_12 CSS https://pastebin.com/tup8Psis
Grid_12 CSS https://pastebin.com/qxAswhVc
发布到 css 的链接认为那里更容易阅读......
解决方案
您将 UL 设置为最大宽度为 767 像素的“无显示”。
@media only screen and (max-width: 767px)
.sf-menu {
display: none !important;
/* float: none; */
这就是您没有菜单的原因,请从您的 UL 中删除“无显示”。
推荐阅读
- r - 在 R 脚本中运行 CPLEX mod
- react-native - 如何向世博项目添加一个信号
- typescript - Webpack 突然不加载自定义 TS-Types
- apache-superset - 多级桑基
- spring-boot-actuator - 有一个 java.lang.NullPointerException
- django - 具有多个操作的基于类的视图权限
- deep-learning - Logits 和标签必须是可广播的:logits_size=[29040,3] labels_size=[290400,3]
- android - 如何从 gradle 任务访问 android studio 中的 java 中的类
- c++ - c++中的“and”和“&&”有什么区别
- datatables - 在javascript中将Datatable父子数据导出为excel