Eliminate the Border from Bootstrap 5 navigation-toggler through standard css styling

I am trying to eliminate the light grey border around the mobile 'hamburger' menu. I am utilizing font-awesome and Bootstrap 5 (imported through CDN) to create it, but I can't figure out how to get rid of the rounded border.

html

    <nav class="navbar navbar-expand-lg navbar-light" role="navigation">
    <div class="container">
    
        <a class="navbar-brand" href="#">Navbar</a>
        <button
            class="navbar-toggler" 
            type="button" 
            data-bs-toggle="collapse" 
            data-bs-target="#navbarSupportedContent" 
            aria-controls="navbarSupportedContent" 
            aria-expanded="false"
            aria-label="Toggle navigation">
            <i class="fas fa-bars"></i>
        </button>

     ...

css

.navbar-toggler {
  &:focus {
    outline: none;
  }
}

https://i.sstatic.net/GKTUU.png

Everything is functioning correctly except for the border that is still visible: Link to JSfiddle can be found here:

https://jsfiddle.net/r3q1kLcz/ insert image description here

Answer №1

No Boundaries whatsoever.

.navbar-toggler:focus {
    /*Below line will eliminate the boundary from the icon
    I have utilized bootstrap icon here */
    /* This will only eliminate the shadow effect */
    /* Border is still present */
    /* if you don't desire any boundary then set the property equals to zero */
    border: 0 !important;
    box-shadow: none !important;
  
    /* This will eliminate the rounded corner(radious-boundary)
    and provide square boundary */
    /* border-radius: 0 !important; */    
}

.navbar-toggler {
    /* This will completely eliminate boundary from the icon */
    /* If you need boundary for the icon then comment this code */
     border: 0 !important;

    /* if you wish to check the boundary please uncomment below code */
    /* border-color: yellow !important; */
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="11737e7e65626563706151243f233f213c7374657020">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="f89a97978c8b8c8a9988b8cdd6cad6c8d59a9d8c99c9">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous">
  </script>

</head>

<body>
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark mynav">
    <a class="navbar-brand" href=""> Logo</a>

    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon nti"></span>
        </button>

    <div class="collapse navbar-collapse" id="navbarNav">

      <ul class="navbar-nav ms-auto">
        <li class="navbar-item">
          <a class="nav-link" href="">Contact</a>
        </li>
        <li>
          <a class="nav-link" href="">Pricing</a>
        </li>
        <li>
          <a class="nav-link" href="">Download</a>
        </li>
      </ul>
    </div>
  </nav>
</body>

</html>

Answer №2

https://i.sstatic.net/uq5F9.png

To modify the appearance using CSS, use the code below:

.navbar-light .navbar-toggler {
    border-color: transparent !important;
}

Answer №3

Here is the solution:

.navbar-toggler, .navbar-toggler:active, .navbar-toggler:focus{
   border-color: transparent !important;
   box-shadow: none !important;
}

Answer №4

To eliminate the shadow effects on the toggle icon:

.navbar-toggler:focus {
    /* Below line eliminates the border from the icon
    I have used bootstrap icon here */
    /* This will only get rid of the shadow effect */
    /* Border remains */
    /* If you don't want any border then set the property to zero */
    box-shadow: none !important;
  
    /* This will remove the rounded corner (radius-border)
    and provide a square border */
    /* border-radius: 0 !important; */    
}

.navbar-toggler {
    /* This will completely remove the border from the icon */
    /* If you need a border for the icon then comment this code */
    /* border: 0 !important; */

    /* If you want to check the border please uncomment the below code */
    /* border-color: yellow !important; */
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="4b2924243f383f392a3b0b7e6579657b66292e3f2a7a">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="bcded3d3c8cfc8ceddccfc89928e928c91ded9c8dd8d">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous">
  </script>

</head>

<body>
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark mynav">
    <a class="navbar-brand" href=""> Logo</a>

    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon nti"></span>
        </button>

    <div class="collapse navbar-collapse" id="navbarNav">

      <ul class="navbar-nav ms-auto">
        <li class="navbar-item">
          <a class="nav-link" href="">Contact</a>
        </li>
        <li>
          <a class="nav-link" href="">Pricing</a>
        </li>
        <li>
          <a class="nav-link" href="">Download</a>
        </li>
      </ul>
    </div>
  </nav>
</body>

</html>

https://i.sstatic.net/GHdYm.png

Answer №5

To eliminate the circular corners(border-radious)

.navbar-toggler:focus {
    /*Below line will eliminate the border from the icon
    I have utilized a bootstrap icon here */
    /* This will only remove the shadow effect */
    /* Border still exists */
    /* if you don't want any border then set the property equal to zero */
   /* box-shadow: none !important;*/
  
    /* This will remove the rounded corner(radious-border)
    and provide a square border */
     border-radius: 0 !important;
}

.navbar-toggler {
    /* This will completely remove the border from the icon */
    /* If you need a border for the icon then comment this code */
    /* border: 0 !important; */

    /* if you want to check the border, please uncomment the code below */
    /* border-color: yellow !important; */
}
<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8>
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>

  <link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="ec8e8383989f989e8d9cacd9c2dec2dcc18e89988ddd">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-0evHe/X+R7YkIZDRvuzKMRqM+OrBnVFBL6DOitfPri4tjfHxaWutUpFmBp4vmVor" crossorigin="anonymous">
  <script src="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="24464b4b50575056455464110a160a14094641504515">[email protected]</a>/dist/js/bootstrap.bundle.min.js" integrity="sha384-pprn3073KE6tl6bjs2QrFaJGz5/SUsLqktiwsUTF55Jfv3qYSDhgCecCxMW52nD2" crossorigin="anonymous">
  </script>

</head>

<body>
  <nav class="navbar navbar-expand-lg navbar-dark bg-dark mynav">
    <a class="navbar-brand" href=""> Logo</a>

    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarNav" aria-controls="navbarNav" aria-expanded="false" aria-label="Toggle navigation">
          <span class="navbar-toggler-icon nti"></span>
        </button>

    <div class="collapse navbar-collapse" id="navbarNav">

      <ul class="navbar-nav ms-auto">
        <li class="navbar-item">
          <a class="nav-link" href="">Contact</a>
        </li>
        <li>
          <a class="nav-link" href="">Pricing</a>
        </li>
        <li>
          <a class="nav-link" href="">Download</a>
        </li>
      </ul>
    </div>
  </nav>
</body>

</html>
https://i.sstatic.net/K4ysA.png

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

The beauty of Aurelia's scoped CSS

Embarking on my Aurelia journey, I find myself navigating through the vast world of web development with tools like nodejs, gulp, and more. The Aurelia CLI has made it convenient for me to set up a visually appealing Aurelia project in Visual Studio Code ...

Adjust the div height to 100% in Bootstrap to center text, even with the presence of a navbar

I'm currently using Bootstrap 5 and facing an issue with getting text centered vertically on the page. I attempted to make the container of the div take up 100% of the page by using h-100, but it resulted in overflow due to the navbar occupying some s ...

Customize the initial color of the text field in Material UI

I am currently working with the mui TextField component and facing an issue. I am able to change the color when it is focused using the theme, but I cannot find a way to adjust its color (label and border) in its initial state when it's not focused. I ...

Achieving the perfect vertical alignment of navigation buttons alongside a responsive image

Is there a way to ensure that the button always vertically aligns in the middle of the image responsively? I've managed to make the image responsive using .img-responsive, but I'm having trouble keeping the arrow centered on the image at all time ...

Dynamic Display Picture Banner - Adjustable Layout

My home page features a full screen image header that I'm working to make responsive. The width of the image is being cut off on various screen sizes. I've attempted adjusting the height and width settings, but I want the image itself to resize ...

Incorporating an SVG with CSS styling from a stylesheet

After exploring various articles and questions on the topic, I am yet to find a definitive solution. I have an external file named icon.svg, and my objective is to utilize it across multiple HTML files with different fill colors and sizes for each instanc ...

How about having a surprise image pop up when you click a button?

I've been working on coding a button that can change the background of my webpage to display a random image. Initially, my code seemed functional, but it was only displaying the last image listed in my series of if/else statements. I suspect that usin ...

How to make divs occupy the entire space of a parent div?

I've been scouring the website for a solution, but nothing I've found has been helpful. I'm attempting to create a grid within a containing div where a default (and eventually user-specified) number of divs will fill up the space. I'm t ...

Having divs stacked on top of each other with one positioned fixed and the other

In my HTML document, there is a main div element called container that contains several child elements also in the form of divs. One specific child div, named top_bar, has its positioning set to fixed, while the rest of the child divs have relative posit ...

I must update a bootstrap class name within multiple layers of divs by referring to the parent class

My code structure is set up like this: <div id="main-parent"> <div class="child2"> <div> child2 </div> </div> <div>child3</div> - - - - <div class="ch ...

Color-matching cells must be positioned in the same column within the gridbox consecutively

In my current project, I am dealing with a large number of sections. Each section contains one or two rows with columns ranging from 2 to 15, all of equal width. The cells of the same color are placed in the same column, and the layout looks like this: ht ...

Overflowing CSS grid issue

I've been working on this for a couple of hours, but I haven't been able to get it right. I want to add labels in a grid layout with a maximum of 3 columns. If the items don't fit, they should wrap to the next row. It would be great if the i ...

Sidenav Content with all elements having opacity applied

How can I ensure that all page elements have a black background color when the mobile navigation is opened on the left screen, while ensuring that my sidebar and content image do not get overlaid by the black background? Here is my code: function openNav( ...

Adding or removing a class on hover in Tailwind: The simple way!

Is there a way to change the class upon hovering an object using tailwind classes? <span className='group inline-block relative'> Hello <span className='hidden absolute -top-16 left-16 group-hover:inline-block'>&#45; ...

"Discover a unique online platform showcasing videos and images with a creative

I recently updated my personal website to showcase some of the tools I've developed through short looping videos. Initially, everything was working well with just images, but when I switched to videos, I encountered some unexpected behaviors. Interest ...

Modifying the color of a non-active tab - Material UI Tabs

Is there a way to customize the color of inactive tabs in Material UI tabs? I have noticed that they currently appear black, as shown in the screenshot here: screenshot Thank you! ...

Unable to modify the appearance of an HTML element when injected via a Chrome extension

I am currently developing a unique chrome extension that uses Ajax to inject custom HTML into the current tab. This extension appends a <div> element to the body, and now I need to manipulate it using JavaScript. Specifically, I want it to dynamical ...

HTML makes column text wrapping automatic

Is it feasible to implement text wrapping into two columns or more in HTML using solely CSS? I have a series of continuous text enclosed within p tags only, structured as follows: <div id="needtowrap"> <p>Lorem ipsum dolor sit amet, ...&l ...

What is the best way to ensure that a Bootstrap 5 modal is perfectly fitted for image content?

I need help with a webpage that displays an image up to size 400x400px. When the image is clicked, I want it to display in a modal that adjusts its size to fit the actual size of the image. The issue I'm facing is that the modal defaults to 500px reg ...

Exploring Rails 6: Enhancing Web Design with CSS Image Display

I've been attempting to update my webpage background with an image through CSS, but I'm struggling to reference one of my Rails 6 images in the process. Despite trying options like asset-url and image-url, I haven't been successful. However, ...