我需要一个图像以及导航栏品牌上的一些文字。我曾经试图实现这一目标,但没有成功。
如果没有" hacking"引导?
这是我的代码:
<header>
<nav class="navbar navbar-dark fixed-top">
<section class="container">
<section class="navbar-header">
<a ui-sref="home" class="navbar-brand">
<img id="logo" class="d-inline-block mr-1" alt="Logo" src="https://images.vexels.com/media/users/3/137380/isolated/lists/1b2ca367caa7eff8b45c09ec09b44c16-instagram-icon-logo.png">
<span class="align-text-bottom">InstaClone!</span>
</a>
</section>
<ul class="nav navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" ui-sref="chat">Chat</a>
</li>
</ul>
</section>
</nav>
</header>
答案 0 :(得分:1)
如果您使用的是Bootstrap 4 alpha 6,请尝试使用
img#logo{width:50px;}
<script src="https://code.jquery.com/jquery-3.1.1.slim.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0-alpha.6/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-toggleable-md navbar-light bg-faded">
<a class="navbar-brand" href="#"><img id="logo" class="d-inline-block mr-1" alt="Logo" src="https://images.vexels.com/media/users/3/137380/isolated/lists/1b2ca367caa7eff8b45c09ec09b44c16-instagram-icon-logo.png"> <span>InstaClone!</span></a>
<button 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">
<ul class="navbar-nav mr-auto">
<li class="nav-item ">
<a class="nav-link" ui-sref="chat">Chat</a>
</li>
</ul>
</div>
</nav>