I am currently using version 4.4.1 of the Bootstrap gem for my Rails application which includes a Bootstrap 4 navbar. Below is a snippet from my navbar code:
<ul class="navbar-nav ml-auto">
<!-- Hidden li included to remove active class from about link when scrolled up past about section -->
<li class="hidden"> <a href="#top"></a> </li>
..........
<li class="nav-item nav-link"><%= link_to "#{t :link_story}", story_path %></li>
<li class="nav-item nav-link disabled"><%= link_to "#{t :link_blog}", blog_path %></li>
<li class="nav-item nav-link disabled"><%= link_to "https://www.facebook.com/xxxxxxxx/", target: "_blank" do %><i class="fab fa-facebook-f"></i><% end %></li>
<li class="nav-item nav-link disabled"><%= link_to "https://twitter.com/lightbecorp", target: "_blank" do %><i class="fab fa-twitter"></i><% end %></li>
</ul>
The use of the disabled class prevents clicking on links, which suits my purpose. I aim to have these links appear gray.
Below is the CSS code, with the last line attempting to change the font color:
.navbar-custom { padding: 0; border-bottom: 0; letter-spacing: 1px; background: $navBackColor; text-transform: uppercase; }
.navbar-custom .navbar-brand { text-transform: capitalize; }
.navbar-custom .navbar-brand:focus { outline: 0; }
.navbar-custom .navbar-toggler { color: #eee; font-size: 129%; border-radius: 2px; padding: 0 4px; }
.navbar-custom .navbar-toggler:hover, .navbar-custom .navbar-toggler:focus { background-color: #e75926; color: #ffffff; }
.navbar-custom .navbar-brand .navbar-toggler:focus, .navbar-custom .navbar-brand .navbar-toggler:active { outline: 0; }
.navbar-custom a { color: $linkColor; font-weight: bold; }
.navbar-custom i.fas { color: $red; font-weight: bold; }
.navbar-custom .navbar-nav li a { -webkit-transition: background .3s ease-in-out; -ms-transition: background .3s ease-in-out; -moz-transition: background .3s ease-in-out; transition: background .3s ease-in-out; }
.navbar-custom .navbar-nav li a:hover { outline: 0; color: $linkColorHover; background-color: transparent; }
.navbar-custom .navbar-nav li a:focus, .navbar-custom .nav li a:active { outline: 0; background-color: transparent; color: $linkColorHover; }
.navbar-custom .navbar-nav li.active { outline: 0; }
.navbar-custom .navbar-nav li.active a { background-color: rgba(255,255,255,.3); }
.navbar-custom .navbar-nav li.active a:hover { color: $linkColorHover; }
.navbar-custom .navbar-nav li .disabled { color: $grayDisabled; }
I have attempted various methods to no avail:
.navbar-custom .disabled { color: $grayDisabled; font-weight: bold; }
.navbar-custom a { color: $linkColor; .disabled { color: $grayDisabled; font-weight: bold; } font-weight: bold; }
.navbar-custom .navbar-nav li a.disabled { color: $grayDisabled; }
.navbar-custom a.disabled { color: $grayDisabled; font-weight: bold; }
All references found relate to Bootstrap 3 where pointer-events: none;
was used in the stylesheet. The .disabled class utilizes pointer-events: none;
.
To maintain consistent styling while changing only the font color of certain items, I intend to use classes .nav-item and .nav-link.
The documentation does not specify restrictions on changing the font color of a class. How can this be achieved?