2017-04-14 34 views
-1

我想將我的徽標放置在左上方,位於導航欄內。使用引導程序在頁眉中定位徽標

  1. 當我嘗試使用'margin-right'將其放置在導航欄的最左側時,我的徽標將不會響應。

    1. 當我將徽標置於左側時,會將菜單向右推到導航欄的中間位置。

誰能給我建議?

Picture

謝謝。

<!DOCTYPE html> 
 
<html lang="en"> 
 
    <head> 
 
    <meta charset="utf-8"> 
 
    <meta http-equiv="X-UA-Compatible" content="IE=edge"> 
 
    <meta name="viewport" content="width=device-width, initial-scale=1"> 
 
    <!-- The above 3 meta tags *must* come first in the head; any other head content must come *after* these tags --> 
 
    <title>Arabella Hill</title> 
 

 
    <!-- Bootstrap --> 
 
    <link href="css/bootstrap.min.css" rel="stylesheet"> 
 

 

 
    <!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries --> 
 
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// --> 
 
    <!--[if lt IE 9]> 
 
     <script src="https://oss.maxcdn.com/html5shiv/3.7.3/html5shiv.min.js"></script> 
 
     <script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script> 
 
    <![endif]--> 
 
    </head> 
 
    <body> 
 
    <div class="navbar navbar-default navbar-fixed-top" role="navigation"> 
 
    <div class="container-fluid"> 
 
    <div class="navbar-header"> 
 
     <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse"> 
 
      <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='#'><img src="img/arabella.png" class="img-responsive" img style="max-width:300px; margin-top:-80px; margin-right: 100px;"></a> 
 
    </div> 
 
    <div class="navbar-collapse collapse" id="navbar-collapse"> 
 
     <ul class="nav navbar-nav navbar-right"> 
 
     <li><a href='#'>Home</a></li> 
 
     <li><a href='#'>About</a></li> 
 
     <li class="dropdown"> 
 
      <a href='#' class="dropdown-toggle" data-toggle="dropdown">Themes<b class="caret"></b></a> 
 
     <ul class="dropdown-menu"> 
 
      <li class="dropdown-header">Admin & Dashboard</li> 
 
      <li><a href="#">Admin 1</a></li> 
 
      <li><a href="#">Admin 2</a></li> 
 
     </ul> 
 
     </li> 
 
     </ul> 
 
    </div> 
 
    </div> 
 
</div> 
 

 
    <!-- jQuery (necessary for Bootstrap's JavaScript plugins) --> 
 
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script> 
 
    <!-- Include all compiled plugins (below), or include individual files as needed --> 
 
    <script src="js/bootstrap.min.js"></script> 
 
    </body> 
 
</html>

+0

請發佈您的CSS。 – user886

+0

我沒有,它是bootstrap。 – Benjamints

+0

如果我有任何,我已經在HTML文件中設置它。 – Benjamints

回答

0

您是否嘗試過使用「利潤率左」與負值?

... margin-top:-80px;保證金左:-20px; ...

您可能需要更改值以適應圖像尺寸。

0

在.navbar或.navbar- header類上可能會有其他一些樣式,它們正在推動它。

查看瀏覽器檢查工具以檢查這些DIV是否有額外的樣式。

0

擺脫您的徽標上的保證金。這是推動你的導航權。

如果你想對屏幕

<a class="navbar-brand" href='#'><img src="img/arabella.png" class="img-responsive" style="max-height:50px; margin-top:-80px; margin-left: -30px;"></a> 

我也建議使用左側我會建議把你的風格的CSS文件,但如果你打算做內聯嘗試這樣的事情開發者檢查員在您的瀏覽器上查看填充和邊距如何影響徽標。

相關問題