尝试在boostrap徽标中添加图像徽标 [英] Trying to add an image logo inside a boostrap logo
本文介绍了尝试在boostrap徽标中添加图像徽标的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有以下导航条码,如您所见,我试图添加图像作为徽标而不是文本.以下无效.
I have the following nav bar code and as you can see I have tried to add an image as a logo instead of text. The below doesn't work.
<li class="nav-item">
<a class="nav-link active" aria-current="page" img src="https://www.pngfind.com/pngs/m/572-5720766_eye-logos-png-image-with-transparent-background-eyelid.png">Home</a>
</li>
也尝试过:
<a class="nav-link active" aria-current="page" >img src="https://www.pngfind.com/pngs/m/572-5720766_eye-logos-png-image-with-transparent-background-eyelid.png"</a>
尝试3
<li class="nav-item">
<a class="nav-link active" aria-current="page" img src="https://www.pngfind.com/pngs/m/572-5720766_eye-logos-png-image-with-transparent-background-eyelid.png"</a>
</li>
我还想知道去哪里/使用什么文档来找到正确的语法
I'd also like to know where to go/what docs to use to find the right syntax for these things
推荐答案
您需要将徽标放置在 a
标记内,并使用 navbar-brand
类作为 img
标签.
You need to place the logo within the a
tag with a class of navbar-brand
as an img
tag.
您没有正确编写 img
标记的语法.正确的语法是< img src ="alt ="/>
You didn't write the syntax of an img
tag correctly.
The correct syntax is <img src="" alt=""/>
完整示例:
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.0.0-beta1/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav class="navbar navbar-expand-md navbar-light bg-light fixed-top">
<a class="navbar-brand" href="/"><img src="https://www.pngfind.com/pngs/m/572-5720766_eye-logos-png-image-with-transparent-background-eyelid.png" class="d-inline-block align-top" loading="lazy" style="width: 100px;"/></a>
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarNav">
<ul class="navbar-nav">
<li class="nav-item">
<a class="nav-link" href="/">HOME</a>
</li>
</ul>
</div>
</nav>
这篇关于尝试在boostrap徽标中添加图像徽标的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文