1

I have an issue with bootstrap-vue navitem. I cannot set the witdh of the components, therefore when I change the language of my website the navbar items jump around.

This is what it looks like:

Language 1 Language 2

The code looks like this and i tried adjusting the width with element, then I added a class and still nothing happened

      <b-nav-item right href="/">
          {{ $t("header.Login_Header") }}
      </b-nav-item>

      <b-nav-item right href="/">
          {{ $t("header.Register_Header") }}
      </b-nav-item>

      <b-nav-item right href="/">
        {{ $t("header.LoginUser_Header") }}
      </b-nav-item>

        <b-nav-item right href="/"
        @click="logout">
          {{ $t("header.Logout_Header") }}
      </b-nav-item>

    </b-navbar-nav>


b-navbar-item{
    width: 5%;
}

Any help would be nice. Thank you.

5
  • What have you tried? Code examples? stackoverflow.com/help/how-to-ask Commented Feb 13, 2018 at 18:56
  • 1
    It is my first question here, and I have got a suggestion, that I should remove the codes, so I did. But it is back again. Commented Feb 14, 2018 at 8:19
  • Your CSS rule has to target a valid html element, not a component. Commented Feb 14, 2018 at 8:31
  • Thank you Micael. This solved my problem. I had to style my li element. Commented Feb 14, 2018 at 8:48
  • @MicaelNussbaumer if you add it as an answer I will gladly accept it. Commented Feb 14, 2018 at 10:09

1 Answer 1

1

You can pass styles to components (they will get applied to the root element of the component)

<b-nav-item right href="/" :style="{ minWidth: '20rem' }">
  {{ $t("header.Login_Header") }}
</b-nav-item>

You could also createa custom class and apply it:

.my-nav-item {
  min-width: 20rem;
}
<b-nav-item right href="/" class="my-nav-item">
  {{ $t("header.Login_Header") }}
</b-nav-item>
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.