图像重叠折叠导航栏

时间:2016-12-31 14:12:43

标签: html css twitter-bootstrap navigation navbar

我在互联网上找不到这样的东西,所以我问你们!问题是我的图标与折叠的导航栏重叠。

Image here

我的代码:

<?php
header("Location:http://google.com")
?>

CSS:

 <div class="container-fluid">
                                    <div class="row">
                                        <div class="">
                                            <div id="black">
                                            <nav class="navbar navbar-default navbar-inverse" role="navigation">
                                              <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">
                                                        <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="img-responsive col-xs-4 col-sm-8 col-md-10 col-lg-12" href="#"> 
                                                        <img id="logo2" alt="Logo" class="" height="80%" width="73%" src="images/logo1.png"> 
                                                      </a>
                                                </div>

 <div class="container-fluid">
                <div class="row">
                    <div class="">
                        <div id="black">
                        <nav class="navbar navbar-default navbar-inverse"                             role="navigation">
                          <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">
                                    <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="img-responsive col-xs-4 col-sm-8 col-md-10 col-lg-12" href="#"> 
                                    <img id="logo2" alt="Logo" class="" height="80%" width="73%" src="images/logo1.png"> 
                                  </a>
                            </div>

<!-- Navbar contentas -->
    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav">
        <li><a class="visible-lg" href="#">Pagrindinis</a></li>
        <li><a class="visible-lg" href="#">Kontaktai</a></li>
        <li><a class="visible-lg" href="#">Apie mus</a></li>
        <li><a class="visible-lg" href="#">Paslaugos</a></li>
        <li><a href="#"></a></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown">Dropdown <span class="caret"></span></a>
          <ul class="dropdown-menu" role="menu">
            <li><a href="#"></a></li>
            <li><a href="#">Pagrindinis</a></li>
            <li><a href="#">Apie mus</a></li>
            <li><a href="#">Kontaktai</a></li>
            <li><a href="tel:+" onclick="ga('send', 'event', { eventCategory: 'Mygtukas', eventAction: 'Telefonas'});">+370 67651008</a></li>
            <li class="divider"></li>
            <li><a href="#">One more separated link</a></li>
          </ul>
        </li>
      </ul>
      <ul class="nav navbar-nav navbar-right">
        <li><p class="navbar-text" style="margin-left: 15px;" >Already have an account?</p></li>
        <li class="dropdown">
          <a href="#" class="dropdown-toggle" data-toggle="dropdown"><b>Login</b> <span class="caret"></span></a>
            <ul id="login-dp" class="dropdown-menu">
                <li>
                     <div class="row">
                            <div class="col-md-12">
                                Login via
                                <div class="social-buttons">
                                    <a href="#" class="btn btn-fb"><i class="fa fa-facebook"></i> Facebook</a>
                                    <a href="#" class="btn btn-tw"><i class="fa fa-twitter"></i> Twitter</a>
                                </div>
                                or
                                 <form class="form" role="form" method="post" action="login" accept-charset="UTF-8" id="login-nav">
                                        <div class="form-group">
                                             <label class="sr-only" for="exampleInputEmail2">Email address</label>
                                             <input type="email" class="form-control" id="exampleInputEmail2" placeholder="Email address" required>
                                        </div>
                                        <div class="form-group">
                                             <label class="sr-only" for="exampleInputPassword2">Password</label>
                                             <input type="password" class="form-control" id="exampleInputPassword2" placeholder="Password" required>
                                             <div class="help-block text-right"><a href="">Forget the password ?</a></div>
                                        </div>
                                        <div class="form-group">
                                             <button type="submit" class="btn btn-primary btn-block">Sign in</button>
                                        </div>
                                        <div class="checkbox">
                                             <label>
                                             <input type="checkbox"> keep me logged-in
                                             </label>
                                        </div>
                                 </form>
                            </div>
                            <div class="bottom text-center">
                                New here ? <a href="#"><b>Join Us</b></a>
                            </div>
                     </div>
                </li>
            </ul>
        </li>
      </ul>
    </div><!-- /.navbar-collapse -->
  </div><!-- /.container-fluid -->
</nav>          
    </div>
        <div id="mint"></div>
            <div class="" id="background1">
                <div class="container-fluid">
                    <img class="img-responsive" id="logo1" src="images/logo1.png"/>
                </div>
                <div class="container-fluid">
                    <p id="p1" class="" >A great new free psd theme to showcase your<br>new application.</p>
                </div>
                <div id="sicons">
                    <img class="img-responsive col-xs-3 col-sm-3 col-md-4 col-lg-4" src="images/icon1.png"/>
                    <img class="img-responsive col-xs-3 col-sm-3 col-md-4 col-lg-4" style="margin-left: -15px; margin-right: -15px;" src="images/icon2.png"/>
                    <img class="img-responsive col-xs-3 col-sm-3 col-md-4 col-lg-4" src="images/icon3.png"/>
                </div>
            </div>

1 个答案:

答案 0 :(得分:1)

通过查看您的代码示例,看起来罪魁祸首#sicons的值为position: absolute;。绝对定位的物品将始终位于相对位置物品的顶部。尝试使用#sicons值分配导航栏和z-index容器,使#sicons的值低于导航栏。

有关z-index如何工作,如何与定位元素进行交互以及堆叠顺序的详细信息,请查看此Stack Overflow问题的答案:"Understanding z-index stacking order"