Is there a way to eliminate the white line on my bootstrap navbar and customize the text colors?

I've been experimenting with Bootstrap and want to create a small personal page with a navbar design like the one below:

<body>
<nav class="navbar navbar-default navbar-fixed-top navbar-shrink">
<div class="container">
    <div class="navbar-header page-scroll">
        <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
        </button>
        
        <a class="navbar-brand" href="#home">Jon Snow</a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
        <ul class="nav navbar-nav navbar-right">
            <li class="page-scroll">
                <a href="#about">About Me</a>
            </li>
            <li class="page-scroll">
                <a href="#work">Work</a>
            </li>
            <li class="page-scroll">
                <a href="#blog">Blog</a>
            </li>
            <li class="page-scroll">
                <a href="#contact">Contact Me</a>
        </ul>
    </div>
   </div>
  </nav>
</body>

The styling for this navbar should be as follows:

body {
   background-color:#2c3e50;
 }

.navbar-fixed-top.navbar-shrink {
   color:white;
   padding: 10px 0;
   background: rgba(0, 0, 0, .1);
 }

However, I'm encountering an issue with a white line appearing in the navbar, visible in this image: https://i.sstatic.net/RQLST.png

How can I remove this white line and change the colors of the items in the Navbar to white?

Here is a JS Fiddle.

Answer №1

Below are instructions on how to remove borders and change the color of the li items for all viewports.

Take a look at the demonstration in the Snippet provided.

body,
html {
  background: #2c3e50;
}
.navbar.navbar-default {
  padding: 10px 0;
  background: rgba(0, 0, 0, .1);
  border: none;
}
.navbar.navbar-default .navbar-nav > li > a,
.navbar.navbar-default .navbar-brand {
  color: white;
}
.navbar.navbar-default .navbar-collapse {
  border: none;
  box-shadow: none;
}
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js"></script>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" />
<nav class="navbar navbar-default navbar-fixed-top navbar-shrink">
  <div class="container">
    <div class="navbar-header page-scroll">
      <button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
        <span class="sr-only">Toggle navigation</span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
        <span class="icon-bar"></span>
      </button>

      <a class="navbar-brand" href="#home">Jon Snow</a>
    </div>

    <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
      <ul class="nav navbar-nav navbar-right">
        <li class="page-scroll">
          <a href="#about">About Me</a>
        </li>
        <li class="page-scroll">
          <a href="#work">Work</a>
        </li>
        <li class="page-scroll">
          <a href="#blog">Blog</a>
        </li>
        <li class="page-scroll">
          <a href="#contact">Contact Me</a>
      </ul>
    </div>
  </div>

Answer №2

To enhance the appearance of your navigation bar, consider incorporating these styling elements:

.top-menu { border: none!important; }

The default Bootstrap navigation bar comes with a pre-set border design.

Additionally, you can customize the color scheme using:

.nav-bar-custom .menu-items li a { color: #ffffff; }

Answer №3

This individual right here:

.navbar-custom {
    background-color: #f5f5f5;
}

Try changing that to transparent or a similar color to your site's background. That should solve the issue.

UPDATE

Apologies for overlooking part two of your inquiry. This code snippet will adjust the text color in the navigation bar:

.navbar-custom .nav-links>li>a {
    color: #000;
}

To add a style for when hovering (or any other action):

.navbar-custom .nav-links>li>a:hover {
    color: blue;
}

Answer №4

The issue stems from the CSS code within Bootstrap

.navbar-default {
  background-color: #f8f8f8;
  border-color: #e7e7e7;
}

You have the ability to replace the border-color with any color you desire.

To modify the link colors, use the following code:

.navbar-default .navbar-nav > li > a{
    color:**your color** !important;
}

You can also define hover, active, focus, and visited colors for the links like so:

.navbar-default .navbar-nav > li > a:hover{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:active{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:focus{color: **your color** !important;}
.navbar-default .navbar-nav > li > a:visited{color: **your color** !important;}

I trust this information proves useful!

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

Selenium is unable to locate clickable elements even after waiting

Looking to extract the team statistics available on this page: The page features multiple drop-down menus, with my focus being on six specific ones detailing the 2022/23 statistics (Attack, Defence, Kicking, Discipline, Lineouts, Scrums). Upon inspection ...

Displaying HTML content via Java Proxy Servlet

I have been using the code snippet below public class ProxyServlet extends HttpServlet { private static final long serialVersionUID = 1L; private final String USER_AGENT = "Mozilla/5.0"; public ProxyServlet() { super(); } ...

The content from http://x.com/js/bootstrap.min.js.map could not be retrieved due to an HTTP error with a status code 404, showing a net::ERR_HTTP_RESPONSE_CODE_FAILURE

I'm working on an HTML CSS Website and encountering a consistent error. Some solutions suggest using Developer Tools in the browser to resolve it, but after trying multiple browsers, I suspect the issue lies within the code itself. Can anyone offer as ...

Is there a way to extract the content within the HTML tags as well as the text enclosed within parentheses?

When working with my HTML content, I came across the following line: <span>(48 עמודים סה"כ )</span> I am seeking a way to extract only the text "48 עמודים סה"כ" and store the number 48 into an integer variable. Although in t ...

Jekyll adjusting the starting line of code snippet formatting

Currently, I'm in the process of setting up code highlighting for my blog using Jekyll and Pygments. However, I'm facing an issue where the first line of every code snippet seems to be slightly offset. To create a gutter effect, I'm utilizin ...

The drop-down links vanish into the depths of the webpage's body

Can someone assist with my drop-down menu issue for the link "services"? The link disappears behind the page content when I try to modify it. Any help would be appreciated, thank you! This is the CSS: .bodycontent { margin: 0 25% 0 25%; ...

jQuery Load - Oops! There seems to be a syntax error: Unexpected token <

Error: Uncaught SyntaxError: Unexpected token < I encountered the error message mentioned above while trying to execute a jQuery load function: $('#footer').load(UrlOfFooterContent); The variable UrlOfFooterContent holds the URL of an MVC c ...

The current limitation of the Dev.to API restricts the display of only the most recent

For the past 3 years, I've integrated Dev.to's public API into my portfolio to display all of my articles. However, after transitioning my entire portfolio to ReactJS and SaSS from native HTML, CSS, and JS, it now only shows my latest 30 articles ...

What is the process to modify the font color on a webpage using a button?

I need some help figuring out how to change the font color on my website when someone clicks a button. I already have the background functionality working, but I can't seem to get the text color to change. This is the code I have so far: <div cl ...

placing a command button to the right side

Currently, I have successfully implemented a graphical solution using jsf2.2 primefaces 6.0 to allow users to view, download, and print pictures through the galleria component of primefaces. However, I am facing an issue with positioning the print command ...

Removing a Dom element using stage.removeChild( )

When the number 6 is typed and entered into the game, the function correct() in the code snippet below determines what action to take. I would like to remove the DOM element gg (the equation 3+3=input) from the stage after typing 6 and pressing enter. How ...

JavaScript recording speed

I am currently working on a project that involves video recording on my website. After creating a canvas and pushing the recorded frames to it, I have encountered an issue. The playback of the video is too fast - a 10-second video plays in around 2 second ...

Incorporate a button into your Django formset application

Working with Django 5, I am in the process of creating a web application for managing a Secret Santa gift exchange project. One issue I'm facing is that formsets are not dynamic, meaning I cannot generate a variable number of forms based on user inpu ...

Creating a Mobile-friendly Sidebar: A Guide to Angular 5

I've been seeing a lot of recommendations online about using Angular Material for creating a sidebar, but I'm hesitant to install an entire library just for one component. After following the instructions provided here, I managed to develop a si ...

Ways to conceal an image by using two functions upon clicking

I have a unique concept in mind - I want to create a functionality where on clicking an image, it would hide the image and start playing content in the background. The content would be an iframe video without a play button, so clicking anywhere on the vi ...

Autofocus Styling with CSS Bootstrap

Currently, I am working on creating a grid of large buttons using React and Bootstrap. I have implemented CSS for hover and focus effects on these buttons. My main issue arises when I try to load the screen with one button already focused. I attempted to ...

Troubleshooting problems with the width of a UI Bootstrap accordion container

Check out this Plunker for help! Having some trouble with ng-Grid inside a ui.bootstrap accordion. Visit my Plunker to see the issue firsthand. Essentially, when I place a grid inside an accordion with the child accordion-group closed upon page load, the ...

Enhancing Material UI KeyboardDatePicker with personalized CSS design

Material UI KeyboardDatePicker is the component I'm currently using. https://i.sstatic.net/It50L.png In order to remove the black line visible in the datepicker (as shown in the screenshot), what steps should I take? Displayed below is the code ...

Removing the previously selected file from an input type file in Angular JS

I am implementing an upload control using AngularJS with the input type="file" feature. Whenever I click on browse, the previously selected file is retained by default, but I want to prevent this behavior. Is it possible to achieve this by creating a custo ...

Border extends across two separate rows

Let me illustrate my issue with a specific example where I am utilizing a single column with a rowspan: <table border="1" style="width:300px"> <tr> <td rowspan="2">Family</td> <td id="jill">Jill</td> <td>Smi ...