Visibility issue with Bootstrap dropdown menu

Attempting to create a navbar with dropdowns using Bootstrap 4. After clicking the dropdown link, nothing is happening. Highlighting the dropdown menu in Chrome's dev tools shows that it has expanded but is not visible. Followed examples on w3schools closely, so assuming the CSS might be causing the issue. Any ideas on what could be wrong?

The code is provided below, and an jsfiddle has been created to replicate the error. The top of the menu can be seen, but it does not extend beyond the div's bottom.

HTML:

<!DOCTYPE html>
<html lang="en">
<head>
    <title>my site</title>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/css/bootstrap.min.css">
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.0/umd/popper.min.js"></script>
    <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.1.0/js/bootstrap.min.js"></script>

    <link rel="stylesheet" href="css/stylesheet.css">
</head>

<body>
<div class="container" id="main-container">
    <div class="header row">
        <h1 class="col-md-4">
            <a href="#" title="Home page">
                <img src="images/logo.png" />
            </a>
        </h1>
        <div class="col-md-8">
            <nav class="navbar navbar-expand-sm">
                <ul class="navbar-nav">
                    <li class="nav-item dropdown">
                        <a class="nav-link dropdown-toggle" href="#" data-toggle="dropdown">Link 1</a>
                        <div class="dropdown-menu">
                            <a class="dropdown-item" href="#">Link 1a</a>
                            <a class="dropdown-item" href="#">Link 1b</a>
                            <a class="dropdown-item" href="#">Link 1c</a>
                        </div>
                    </li>
                    <li class="nav-item"><a class="nav-link" href="#">Link 2</a></li>
                    <li class="nav-item"><a class="nav-link" href="#">Link 3</a></li>
                    <li class="nav-item"><a class="nav-link" href="#">Link 4</a></li>
                </ul>
            </nav>
        </div>
    </div>
</div>
</body>

</html>

Sass:

body
    background-color: #ddd;

    #main-container
        background-color: #fff;
        margin-top: 10px;
        border-radius: 20px 20px 0 0;

.header
    position: relative;
    margin: 0 10px 20px 10px;
    border-bottom: 3px solid #444;

    h1
        margin: 0;

.navbar
    overflow: hidden;
    background-color: #333;
    font-family: Arial;
    position: absolute;
    right: 0;
    bottom: 0;
    padding: 0;
    background-color: #fff;

.navbar-expand-sm
    .navbar-nav
        .nav-link
            color: #444;
            text-align: centre;
            text-decotation: none;
            font-size: 17px;
            padding: 13px 16px 9px 16px;
            border-radius: 16px 16px 0 0;

            &:hover
                background-color: #444;
                color: #e5e5e5;

Answer №2

To fix the hidden dropdown issue, you should remove the specific CSS code mentioned below:

@media (min-width: 576px)
.navbar-expand-sm .navbar-nav .dropdown-menu {
  /* position: absolute; */
}

I have commented out the problematic CSS in this section.

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

What is the best way to set up a dropdown menu in a data grid where the width matches the fields?

I am looking to optimize the layout for various screen resolutions and ensure compatibility with the latest versions of IE, Firefox, and Chrome. https://i.sstatic.net/3OLh0.jpg ...

Slider Adjusts Properly on Chrome, but Not on Firefox

Visit this URL This link will take you to the QA version of a homepage I've been developing. While testing, I noticed that the slider on the page works perfectly in Chrome and IE, but has layout issues in Firefox where it gets cutoff and moved to th ...

Choosing an item within a jQuery each() method

I have been encountering some challenges while looping through a specific element and extracting values from each element using the jQuery .each() function. Although I have successfully retrieved two values, I am now facing undefined errors and struggling ...

display the entire calendar for the chosen month

I am currently using Foundation Datepicker and Full Calendar. My requirement is as follows: 1) When I select a date in the calendar, For example, let's say it's July 2016. If I choose a date in November or any other month in the Foundation Date ...

Arranging items in CSS and showing them stacked on top of each other

How can I rearrange the order of id3 to be displayed below id2 instead of on the side using CSS? Here is an example of the HTML and CSS: HTML <div class="main" ></div> <div id="id1">Im in div1</div> <div id="id2">Im in div2 ...

I am puzzled as to why the frames in my code are failing to display

I'm attempting to create a simple two-frame menu and content system, but I've been struggling to display the frames properly. Here's the snippet of code that I'm working with. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http: ...

Selecting options in combobox for each row in a table using Angular 2 programmatically

I am currently working on an Angular 2 application using TypeScript. In one of the tables within the application, there is a select control in one of the columns. The contents of this select control are bound to another string array. <table ngContr ...

Is there a way to adjust the label elevation for a Material UI TextField component?

I am trying to enhance the appearance of a textfield label, but I am facing some challenges with my code. textStyle: { backgroundColor: '#1c1a1a', border: 0, borderRadius: 0, width: 400, height: 66, display: 'flex&a ...

Conceal the navigation bar when scrolling to the top of the

Hey there! I'm looking for a way to hide my navigation bar when not scrolling, and then display it again once I start scrolling. Currently, I have two menus on this website: one with a white background and the other with a blue background. You can fi ...

Highlight all the written content within the text box

I'm struggling with a piece of code that is supposed to select all the text inside an input field: <input id="userName" class="form-control" type="text" name="enteredUserName" data-ng-show="vm.userNameDisplayed()" data-ng-model="vm.enteredUs ...

Insert the element both before and after it is referenced

There was a php script I was working on that involved calling a function. For example, here is the script: <div class="main-info"> <div class="screenshot"> </div> </div> <div class="screenshot-later" ...

The excessive repetition in Angular flex layout is becoming overwhelming

I discovered and started using the responsive API provided by angular flex layout. While most of the time it works as intended, there are instances where I find myself duplicating directives in the code. Here's a simplified example: <div> &l ...

Top method for eliminating the default IOS date picker

My jQuery datepicker is functioning perfectly on all web browsers, however, I am encountering an issue when viewing it on mobile devices such as the iPad. The default IOS date picker also appears alongside mine. What would be the most effective way to elim ...

Customizing date format in a dropdown list

Utilizing a DataTable to populate a dropdownlist on my web form, along with a stored procedure for database query. The dropdown list fetches only one field from the database and will be used in conjunction with a gridview to display all reservations made o ...

Encountering a "403 Forbidden" error upon deployment to the server due to

Situation: I am developing a website using Spring web MVC, JSP, and HTML/JavaScript. One of the features I have implemented is a search function that communicates with imdbapi.org to retrieve movie/TV show information in JSON format via AJAX. The JSON resp ...

Tips for ensuring that divs resize to match the container while preserving their original proportions:

#container { height: 500px; width: 500px; background-color: blue; } #container>div { background-color: rgb(36, 209, 13); height: 100px; } #one { width: 1000px; } #two { width: 800px; } <div id="container"> <div id="one">&l ...

What is the best way to align a button with a title on the right side of a page?

Is it possible to align my button to the top right, at the same height as the title in my design? Here is an example: view image here This is what I have achieved so far: view image here I suspect there may be an issue with my divs. The button doesn&a ...

What could be the reason behind the malfunction of the sideNav function in bootstrap?

I am trying to implement a Bootstrap navbar, but it's not displaying correctly. I keep getting an error in my console that says: https://i.sstatic.net/UwbAS.png I've rearranged the order of my scripts in the head section, but I still can't ...

How can I modify the HTML code for rooms in the HTML 5 client of the bigbluebutton application?

Is it possible to customize the HTML code of rooms within the BigBlueButton source code? Additionally, how can I modify the CSS styles of elements in room sessions? For instance, I am interested in hiding the logo of BigBlueButton by setting 'display: ...

Easy selector for choosing jquery css backgrounds

Here is a simple background selector that I created. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <hea ...