Bootstrap,HTML-将Div与导航栏一起使用

问题描述 投票:0回答:1

在我的项目中,我实施了引导程序以创建导航栏。此操作成功完成,并且导航栏完全响应。

当屏幕达到特定大小时,将出现汉堡包图标,允许用户选择导航栏选项。

用户按下汉堡包图标后,我希望在其正下方显示一个小方框/格。我已执行媒体查询,以使当汉堡包图标消失时该框不会出现。

但是我想要实现的是,当用户重新缩放窗口时,我希望div框与汉堡包图标一起移动。

这是我现有的代码:

<nav style="height: 80px;" class="navbar navbar-expand-lg navbar-dark bg-dark">
   <img src="{% static 'myicon.png' %}" style="margin-left: -15px;" width="99px" height="91px" class="navbar-brand bIcon" alt="Image of scissors and comb">
   <div class="navbar-brand" style="width: 1px; left: 100px; bottom: 1px;  position: absolute; height: 77px; border: 1px solid #454545;"></div>
   <span class="navbar-brand" style="position: absolute; top: 16px; left: 125px; font-size: 26px; letter-spacing: 1px;" >Test</span>
   <button style="margin-top: -16px;" class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
   <span class="navbar-toggler-icon"></span>
   </button>
   <div class="collapse navbar-collapse" id="navbarSupportedContent">
      // HERE IS THE DIV/BOX I AM TALKING ABOUT => 
      <div class="collapseBox" style="width: 100px; margin-left: 100px; height: 100px; border: 1px solid white;"></div>
      <ul class="navbar-nav mr-auto">
         <li class="nav-item active">
            <a class="nav-link" href="#">Sign Up <span class="sr-only">(current)</span></a>
         </li>
      </ul>
   </div>
</nav>

有人知道如何实现此功能吗?谢谢。

twitter-bootstrap bootstrap-4
1个回答
1
投票

我做了几件事:

© www.soinside.com 2019 - 2024. All rights reserved.