1

According with the documentation, the styles for the navigation bar can be set as follows:

<b-navbar toggleable="lg" type="dark" variant="info">
<!-- Or -->
<b-navbar toggleable="lg" type="dark" variant="dark">

Anyway, just by changing the type and variant props. I want however to set a custom background color like #AABB55. I cannot find an easy way to do it.

Furthermore, when you see the documentation and the source code, you don't have many options.

Is there a way to change this property without needing to touch the <b-navbar> code?

1 Answer 1

14

Damn. I finished the question and I solved it just after.

So, let's say that I have inside the template

<b-navbar toggleable="lg" type="dark" variant="dark">
  <!-- more stuff -->
</b-navbar>

Then in the style you can just add:

<style scoped>
 .navbar.navbar-dark.bg-dark{
    background-color: #AABB55!important;
 }
</style>

Note: without !important it doesn't work for some reason.

Sign up to request clarification or add additional context in comments.

2 Comments

It doesn't work without !important because CSS follows specificity to work out which rule to apply, your rule in theory is not the right one for CSS to apply but with the important flag you raise the specificity calculation for that rule.
With scoped styles, you need to use the /deep/ selector to target inner elements of a child component. vue-loader.vuejs.org/guide/…

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.