[英]Bootstrap Logo Not Fitting In Navbar
我在http://pawfamily.tk/~shivampaw/primahc.com/有一個測試站點。
無論我做什么,徽標都不適合。 我看了很久了。 嘗試將padding更改為0,margin更改為0,調整其大小,但隨后在iPhone上無法正常顯示。
我希望徽標始終在左側,並且顯然我不希望徽標很小。 我也希望它在手機左側。
我該如何實現呢?
這是我的導航欄代碼:
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<a class="navbar-brand" href="#">
<img class="img-responsive" style="" src="images/logo.png" alt="Prima Healthcare">
</a>
<!-- Brand and toggle get grouped for better mobile display -->
<div class="navbar-header page-scroll">
<button type="button" class="navbar-toggle" 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>
</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 navbar-right">
<li <?php echo $home; ?>>
<a href="index.php">Home</a>
</li>
<li <?php echo $b2b; ?>>
<a href="b2b.php">Business to Business</a>
</li>
<li <?php echo $contact; ?>>
<a href="contact.php">Contact</a>
</li>
</ul>
</div>
<!-- /.navbar-collapse -->
</div>
<!-- /.container-fluid -->
</nav>
謝謝!
.navbar-brand
屬性似乎不適用於超大圖像。 我設法通過簡單地刪除.navbar-brand
屬性並將.pull-left
屬性添加到圖像,以使顯示內容與右側內容保持一致,從而實現了目標,如下所示:
<a href="#">
<img class="img-responsive pull-left" src="images/logo.png" alt="Prima Healthcare">
</a>
如果您不打算使圖像可點擊,我什至會徹底刪除錨標記。
我會覆蓋.navbar品牌。 您可以使用媒體查詢為不同的屏幕尺寸定義不同的寬度值。
對於小屏幕,圖像將為200px,對於大屏幕,圖像將放大至250px。 您可以更改數字。
.navbar-brand {
padding: 0;
}
.navbar-brand img {
width: 200px;
}
@media only screen and (min-width : 768px) {
.navbar-brand img {
width: 250px;
}
}
在這里提琴: https : //jsfiddle.net/DTcHh/16983/
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.