如何将徽标与导航栏对齐

时间:2016-12-01 07:16:25

标签: css

如何将徽标与导航栏对齐?我只需要在导航栏中对齐徽标,因为我无法使用边距和填充,它只适用于一页。请在这里帮助我,我的代码

<nav class="navbar navbar-default">
<div class="container-fluid">
  <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="navbar-left disabled" href="#" >
    <?php 
      if (file_exists ('images/logo.jpg')) 
      {
         echo' <img src="images/logo.jpg"  alt="" width="30px" height="30px" style="margin-top:6px"'; 
      } 
      else 
      { 
        echo''; 
      }
    ?>
    </a>
    <a class="navbar-brand" href="home.php"> 
    <?php echo "&nbsp;".$x; ?>
    </a>
  </div>

提前致谢:)

1 个答案:

答案 0 :(得分:0)

这是你正在寻找的吗?

&#13;
&#13;
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet" />
<!-- You already have this, dont copy this -->

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <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="navbar-left disabled" href="#">

      </a>
      <a class="navbar-brand" href="home.php">
        <img src="https://www.w3.org/html/logo/downloads/HTML5_Logo_512.png" width="30" height="30">
      </a>
    </div>
  </div>
</nav>
&#13;
&#13;
&#13;

如果是,请在此处输入代码php - 代码。

<nav class="navbar navbar-default">
  <div class="container-fluid">
    <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="navbar-left disabled" href="#">

      </a>
      <a class="navbar-brand" href="home.php">
        <?php 
            if (file_exists ('images/logo.jpg')) {
                echo '<img src="images/logo.jpg" width="30" height="30">'; 
            } 
                else 
            { 
                echo ''; 
            }
        ?>
      </a>
    </div>
  </div>
</nav>

希望这有帮助。