html - 标题菜单没有出现在我的汉堡包 html 页面中

标签 html css hamburger-menu

你好,

我设计了一个汉堡 html 页面。我的标题“domoos mobile”仅在汉堡包“展开”时显示(我不确定我是否使用了正确的词)。见下图:

enter image description here enter image description here

我不太确定我在这里遗漏了什么以及为什么我的标题显示不正确。

我希望我的问题是可以理解的,并且对其他程序员也有帮助。这是我的第一个手机设计,所以我也希望你能多多包涵 ;)

感谢您的帮助。

html 页面的内容:

<!DOCTYPE html> 
<html> 
<head> 
    <title>Domoos mobile </title>
    <meta http-equiv="refresh" content="600">
    <meta name="viewport" content="width=device-width, initial-scale = 1.0, maximum-scale=1.0, user-scalable=no"/>
    <!--Using jQuery and jQuery UI for display effects--> 
    <script src="js/jquery-2.1.3.min.js"></script> 
    <script src="jquery-1.12.0/jquery-ui.min.js"></script> 
    <!--Using the hamburger menu display code--> 
    <script src="scripts/hamburger.js"></script> 
    <!--Using Media Queries, if the viewport is smaller than 700px use another stylesheet--> 
    <link rel="stylesheet" type="text/css" media="all" href="css/hamburger.css"/>
    <link rel="stylesheet" type="text/css" href="css/mystyle_hamburger.css" />
</head> 
<body>
    <!--This wrapping container is used to get the width of the whole content--> 
    <div id="container">
    <!--The Hamburger Button in the Header--> 
    <header>
        <div id="hamburger"> 
        <div></div> 
        <div></div> 
        <div></div> 
    </div> 
    </header>
    <!--The mobile navigation Markup hidden via css--> 
    <nav> 
        <ul>
            <!--<li><a href="#"><img src="assets/icons/sun_icon.png" alt="" width="14" height="14">menuitem 1</a></li> -->
            <li><a href="#">menuitem 1</a></li> 
            <li><a href="#">menuitem 2</a></li> 
            <li><a href="#">menuitem 3</a></li> 
            <li><a href="#">menuitem 4</a></li> 
            <li><a href="#">menuitem 5</a></li> 
            <li><a href="#">menuitem 6</a></li> 
        </ul>
    </nav>
    <!--The Layer that will be layed over the content 
    so that the content is unclickable while menu is shown--> 
    <a name="top"></a>
    <div id="contentLayer"></div> 
    <!--The content of the site--> 
    <div id="content">      
        <div id="tag_domoos_title">
        <p>Domoos mobile</p>
        </div>
    </div>
    </div>
</body> 
</html> 

CSS 文件 (mystyle_hamburger.css) 的内容:

#tag_domoos_title{
    font-family:Arial;
    font-size: 110%;
    text-align: left;
    position: absolute;
    top: 35px;
    left: 101px;
    color:black;
    z-index:10;
    font-weight: 900;
}

#date{
    font-family:Arial;
    font-size: 90%;
    text-align: left;
    position: absolute;
    top: 85px;
    left: 101px;
    color:blue;
}
#time{
    font-family:Arial;
    font-size: 90%;
    text-align: left;
    position: absolute;
    top: 103px;
    left: 101px;
    color:blue;
}

#tag_sunrise_sunset{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 107px;
    left: 11px;
    color:black;
}

#tag_weather_condition{
    font-family:Arial;
    font-size: 90%;
    text-align: left;
    position: absolute;
    top: 130px;
    left: 11px;
    color:black;
}

#tag_weather_temperature{
    font-family:Arial;
    font-size: 90%;
    text-align: left;
    position: absolute;
    top: 148px;
    left: 11px;
    color:black;
    font-weight: 900;
}

#current_weather_conditions{
    font-family:Arial;
    font-size: 90%;
    text-align: left;
    position: absolute;
    top: 168px;
    left: 11px;
    color:black;
}

#meteo_icon {
  position: relative;
}

#meteo_icon img{
  position: absolute;
  right: 0;
  top: 80px;
}

#meteo_forecast{
    font-family:Arial;  
    font-size: 100%;
    float:left;
    padding-top: 5px;
    padding-right: 0px;
    padding-bottom: 0px;
    padding-left: 10px;
    height:434px;
    width:870px;
    top:200px;
    position: absolute;
}

#meteo_forecast_day1{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 260px;
    left: 11px;
    color:black;    
    font-weight: 600;
}

#meteo_forecast_day2{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 330px;
    left: 11px;
    color:black;    
    font-weight: 600;
}

#meteo_forecast_day3{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 400px;
    left: 11px;
    color:black;
    font-weight: 600;   
}

#meteo_forecast_temperature_day1{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 260px;
    left: 220px;
    color:black;
}

#meteo_forecast_temperature_day2{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 330px;
    left: 220px;
    color:black;
}

#meteo_forecast_temperature_day3{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 400px;
    left: 220px;
    color:black;
}

#meteo_forecast_condition_day1{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 280px;
    left: 11px;
    color:black;
}

#meteo_forecast_condition_day2{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 350px;
    left: 11px;
    color:black;
}

#meteo_forecast_condition_day3{
    font-family:Arial;
    font-size: 80%;
    text-align: left;
    position: absolute;
    top: 420px;
    left: 11px;
    color:black;
}


#domoos_logo{
position: relative; 
}

#domoos_logo img{
  position: absolute;
  left: 0;
  top: 10px;
}

#lorem{
    font-family:Arial;
    font-size: 100%;
    text-align: left;
    position: relative;
    top: 700px;
    left: 10px;
    color:black;
}

最佳答案

好吧,亲爱的,我知道你一开始就错了……你为什么不从 bootstrap 开始?那里有一些很好的模板。您可以将它们用于下拉菜单、搜索框输入等。您可以使用此链接查看一些模板:https://getbootstrap.com/components/#navbar

enter image description here

    enter code here

I also added you something I used from bootstrap site with this code:
<nav class="navbar navbar-default">
  <div class="container-fluid">
    <!-- Brand and toggle get grouped for better mobile display -->
    <div class="navbar-header">
      <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>
      <a class="navbar-brand" href="#">Brand</a>
    </div>

    <!-- Collect the nav links, forms, and other content for toggling -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li class="active"><a href="#">Link <span class="sr-only">(current)</span></a></li>
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <form class="navbar-form navbar-left">
        <div class="form-group">
          <input type="text" class="form-control" placeholder="Search">
        </div>
        <button type="submit" class="btn btn-default">Submit</button>
      </form>
      <ul class="nav navbar-nav navbar-right">
        <li><a href="#">Link</a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu">
            <li><a href="#">Action</a></li>
            <li><a href="#">Another action</a></li>
            <li><a href="#">Something else here</a></li>
            <li role="separator" class="divider"></li>
            <li><a href="#">Separated link</a></li>
          </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>

关于html - 标题菜单没有出现在我的汉堡包 html 页面中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41654689/

相关文章:

html - 单击以在没有 JS 的移动设备上打开和关闭 Bootstrap 汉堡菜单

android - 使用选项卡时汉堡菜单按钮丢失?

html - 如何使用 Bootstrap 在页面中间设置水平和垂直

javascript - 匹配没有标签内容的 HTML 文本

html - 如何避免 <thead> 和 <tbody> 之间的分页符

php - 如何将 Open Sans 字体添加到 mpdf 文档

android - 如何在包含 PCL + Android + iOS 的项目上使用 Xamarin + MVVMCross 4.2 制作 "Hamburger Menu"?

html - 如何减少 Shiny 的交互式 rmarkdown 利润?

html - CSS 中的命名空间和样式冲突

html - Twitter Bootstrap 等高列和内容底部对齐