Home > OS >  I don't know add picture to my company to the navbar - angular12
I don't know add picture to my company to the navbar - angular12

Time:06-07

I can't add logo to the navbar on my angular website.

HTML:

 <nav >
  <div >
    <a  routerLink=""><img src="/src/assets/images/Nikiikejks.png" alt=""></a>
    <button  type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
      <span ></span>
    </button>
    <div  id="navbarNav">
      <ul >
        <li >
          <a  routerLink=""  routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}">Domov</a>
        </li>
        <li >
          <a  routerLink="menu" routerLinkActive="active-link">Menu</a>
        </li>
        <li >
          <a  routerLink="about" routerLinkActive="active-link">O nás</a>
        </li>
        <li >
          <a  routerLink="contact" routerLinkActive="active-link">Kontakt</a>
        </li>
      </ul>
    </div>
  </div>
</nav>

CSS:

.navbar-light .navbar-nav .nav-link
{
  color: var(--secondary-color);
}
.navbar-light .navbar-nav .nav-link.active-link
{
  color: #64cff7;
}
.navbar
{
  background-color: #f7dfde;
  box-shadow: 0px 2px 5px #777 ;
}
.navbar-brand {
  width:150px;
  font-size: 24px;
}
.navbar-brand img {
  height: 30px;
  /* put value of image height as your need */
  float: left;
  margin-right: 7px;
}

I tried add path image and in css add some parameters, but it doesn't works. I don't know, if I have bad size of picture or what?

Thank you.

CodePudding user response:

It is not the image quality. It has nothing to do with making it functional or not. When img is not shown you either have a wrong path (instead of /src/assets you need assets/etc) or wrong extension (your image is .png and not .jpg or the other way around)

CodePudding user response:

I believe you need to leave the folder app first, and after that, go to the assets.

I don't know your folder structure, but if you currently are on app.component or in the folder app, your path should be: ../assets/images/Nikiikejks.png.

  • Related