Why is everyone trying to do it the hard way?
(为什么每个人都试图以艰难的方式去做?)
Sure, some of these approaches will work, but they're more complicated than is necessary. (当然,其中一些方法可行,但它们比必要的更复杂。)
OK, first - you need an image that will fit within your navbar.
(好的,首先 - 您需要一个适合您的导航栏的图像。)
You can adjust your image via css height attribute (allowing width to scale) or you can just use an appropriately sized image. (您可以通过css height属性调整图像(允许宽度比例),也可以使用尺寸合适的图像。)
Whatever you decide to do - the way this looks will depend on how well you size your image. (无论你决定做什么 - 它的外观取决于你的图像大小。)
For some reason, everyone wants to stick the image inside of an anchor with navbar-brand
, and this isn't necessary.
(出于某种原因,每个人都希望用navbar-brand
将图像粘贴在锚点内,这不是必需的。)
navbar-brand
applies text styles that aren't necessary to an image, as well as the navbar-left
class (just like pull-left, but for use in a navbar). (navbar-brand
应用图像不需要的文本样式,以及navbar-left
类(就像navbar-left
,但用于导航栏)。)
All you really need is to add navbar-left
. (你真正需要的是添加navbar-left
。)
<a href="#" class="navbar-left"><img src="/path/to/image.png"></a>
You can even follow this with a navbar-brand item, which will appear to the right of the image.
(您甚至可以使用导航栏品牌项目进行操作,该项目将显示在图像的右侧。)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…