DEV Community

Discussion on: Rails 6 with Bootstrap (Webpacker for JS, Asset Pipeline for CSS)

Collapse
 
rishudc119 profile image
Deepak Chauhan

I have created a layout file as _navigation.html.erb in which I have my navigation bar code . I want to add background color to my nav bar for that I am using $navbar-default-bg:red; in bootstrap.scss file but nothing is happening why?

Collapse
 
amree profile image
Amree Zaid • Edited

I don't think that variable will do anything just by declaring it.

You can use:

<nav class="navbar navbar-dark bg-primary">

<nav class="navbar navbar-light" style="background-color: #e3f2fd;">

For your red, maybe you can try:

<nav class="navbar navbar-dark bg-dangar">

You can always add your own class and then add it the navbar

# scss
.your-custom-class {
  background-color: red;
}

# html
<nav class="navbar navbar-dark your-custom-class">

Based on the given documentation here:

getbootstrap.com/docs/4.0/componen...