What is the best way to eliminate the border from a dropdown menu in bootstrap?

After copying and pasting a dropdown menu from bootstrap, I decided to experiment with it. Initially, I used the dropdown as a button, but then switched it to anchor tags. However, when I made this change, unwanted borders suddenly appeared and no matter what I tried, I couldn't remove them.

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

<div class="d-flex flex-column flex-md-row justify-content-center pb-3 px-md-4 mb-0 bg-white border-bottom box-shadow">
  <div class="btn-group">
    <div class="dropdown">
      <a href="#" onclick="loadPage('Crabs')" class="btn btn-secondary dropdown-toggle ml-3 mr-3 navbartext" type="button" id="dropdownMenu2" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
       Link
      </a>
      <div class="dropdown-menu" aria-labelledby="dropdownMenu2">
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr01')">Medium Soft Shell Crabs</a>
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr02')">Hotel Soft Shell Crabs</a>
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr03')">Prime Soft Shell Crabs</a>
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr04')">Jumbo Soft Shell Crabs</a>
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr05')">Whale Soft Shell Crabs</a>
        <a class="dropdown-item" href="#" onclick="gotoDetail('cr06')">Crab Meat</a>
      </div>
   </div>
 </div>
</div>


#dropdownMenu2 {
    background-color: #ffffff;
    color: #4d4d4d;
}

.dropdown-menu {
    text-transform: capitalize;
}

/* Removes caret from dropdown menu button */
.dropdown-toggle::after{
    display: none;
}

.dropdown:hover .dropdown-menu{
    display: inherit;
  }

Answer №1

I decided to test your code on Codepen.

It seems that all you have to do is delete the .border-bottom class from the main div element.

That simple adjustment should solve the issue.

Answer №2

If you're using bootstrap 4, you can easily achieve a regular link by removing the btn css class. This will make the link behave like a standard anchor tag. Sometimes, the hover effect of the link can be bothersome, which is why I included this snippet in my css files:

.dropdown-toggle:hover {
  color: black;
  text-decoration: none;
}

This code effectively disables the hover effect for the link element.

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

Unable to open modal using a button in PHP

<?php $result = mysqli_query($con, $sql); while ($row = mysqli_fetch_array($result)) { echo '<tr><td>'; echo '<h5 style="margin-left:6px; color:black;">' . $row['id'] . '</h5> ...

The width of PrimeVue InputNumber is too wide for its parent container

I currently have a collection of items in the shopping cart that are displayed using Bootstrap rows and columns. Each item includes a PrimeVue InputNumber component for adjusting the quantity of a specific product within the cart. If you'd like to ex ...

What is the exclusion filter in AngularJS?

I am currently working on implementing a search box with angular in my project: <input type="text" typeahead="item.name for item in list | filter: $viewValue:comparator | orderBy: '+name'"/> As part of this functionality, I am looking to ...

What is the best way to extract data from various HTML files using RVEST and save it into an Excel spreadsheet?

I am struggling to find a solution for my current problem as I am not fluent in R. My challenge is working with 800 html files and accessing all the h2 elements within each file. Currently, I have managed to do this with individual website URLs using the ...

Require checkboxes in AngularJS forms

Currently, I have a form that requires users to provide answers by selecting checkboxes. There are multiple checkboxes available, and AngularJS is being utilized for validation purposes. One essential validation rule is to ensure that all required fields a ...

Issues with connecting static files in express.js

Hey there! I'm having an issue with the redirect not working when I click the "Submit" button on the login page. The code in my index.js file looks like this: app.use(bodyParser.urlencoded({ extended: true })); app.use(express.static(path.join(__dir ...

Reorder elements in CSS Grid

I've been working with a css-grid and it's almost there, but I'm stuck on reordering the items in a specific way. Currently, the html layout is set as “1, 2, 3, 4,…10”, but for smaller screens, I want the visual order to be “1, 2, 4 ...

An illustration of HTML frames

Is this method effective? <html> <body> <center> <frameset rows="50%,50%"> <frame src="images.html"> <frameset> <form action="abc.html"> <input type="submit" name="abc page" value="abc page"> </form> & ...

The display: table attribute is proving to be ineffective in creating the desired table layout. I am seeking alternative ways to

Is there a way to create a table using the CSS property display: table without utilizing the table element? I've searched for examples, but haven't found anything that has been helpful. Can someone please provide a fiddle of a table with a minimu ...

Clearly define where each navigation bar item should be displayed within your Django application using Bootstrap

I've been attempting to specify the exact page where this navbar dropdown should be displayed. I attempted adding this line: {% if request.resolver_match.url_name == 'club_selection' %} class = "active" {% endif %} but it doesn&ap ...

Capture a snapshot of a webpage that includes an embedded iframe

Currently, we have a nodeJS/angular 4 website that contains an iframe from a third party (powerBI Emebdded). Our goal is to develop a feature that allows the end user to capture a screenshot of the entire page, including the content within the iframe. We ...

What could be causing my jQuery click event to behave as if I triggered a click on the parent element?

I have created multiple child divs within a parent div. All the divs are positioned, with the parent div set to absolute and the child divs set to relative. The z-index of the parent div is 400, while the child divs have a z-index of 500. However, when I ...

Display the contents of a JSON array in an HTML format

I have designed an exercise that requires me to display the cities corresponding to each department based on a JSON file. Currently, I am able to display the departments in their respective selections, but I am struggling to only show the cities that corre ...

Incorporating HTML5 transitions into your website

After researching HTML5 transitions and adapting some examples, I finally achieved the desired effect. <!DOCTYPE html> <html> <head> <style> div { width: 50px; height: 50px; } div. ...

Troubleshooting ASP.NET MVC Button Click Issue: Modal Always Retrieves First Row in Table

I've been struggling to find a solution for my issue... :( I would really appreciate it if someone with experience could take a look at it. My current situation: I have a table with multiple rows, including one row with button(s). One of these butto ...

Dynamically linking a video URL to the <video> tag in real-time

How can I dynamically assign a video URL to the <video> tag so that the video will display in the player immediately? This is my current code: <script> jQuery( '#the-video' ).children( 'source' ).attr( 'src', &apo ...

What is the best way to ensure that my website functions properly on Safari mobile?

I successfully created a website that functions well on my computer across all modern browsers. However, a user reported that it is not working on Safari mobile. Upon testing the website on Safari for Windows, it appeared to display correctly. After view ...

Utilize identical animations across various elements

I have a canvas animation in JavaScript that is currently limited to one canvas element with the id "stars". I want to be able to use this animation multiple times without repeating the code. Is there a way to add a class for the canvas elements instead of ...

Customizing scrollbar width and creating a rounded effect in CSS

Is it possible to adjust the width of the scroll bar within a div element? I currently have a div with an automatic scroll bar, but I would like to customize the width of the scroll bar to be thinner and hide the top and bottom arrow marks. ...

Exploring the usage of slots in WebComponents without relying on shadow DOM

I am working on developing a WebComponent without utilizing ShadowDOM. So far, everything has been going smoothly. However, I now aim to create a component that wraps other components similar to how it is done in Angular with @ViewChild / @ViewChildren. (I ...