I am starting out with Bootstrap and I am trying to achieve this kind of look with the Navbar Component
I tried using the Navbar Image and Text code, but the text only continues in one line. I tried adding a break but the text will go below the logo. It'll look like this
This is the code snippet I followed:
<div >
<a href="#">
<img src="/docs/5.2/assets/brand/bootstrap-logo.svg" alt="" width="30" height="24" >
Bootstrap <br> subheading
</a>
</div>
</nav>```
CodePudding user response:
Try this:
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav>
<div >
<div >
<a href="#">
<img src="https://encrypted-tbn0.gstatic.com/images?q=tbn:ANd9GcTi65_HIy_en0R9pg-vjBsO3Fi2CFbJ96MtKdGIGjrlXw&s" alt="" width="100">
<div >
<h1 >Title</h1>
<p >Subheading</p>
</div>
</a>
</div>
</div>
</nav>
CodePudding user response:
Include subheading
into span and add to it position:reltive
to control to it from left and top
nav .navbar-brand span{
position:relative;
top:30px;
left:-90px;
color:red;
}
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet"/>
<nav >
<div >
<a href="#">
<img src=" https://getbootstrap.com/docs/5.2/assets/brand/bootstrap-logo-shadow.png" alt="" width="70" height="70" >
Bootstrap <span> subheading </span>
</a>
</div>
</nav>