Troubleshooting Problem with Bootstrap 4 Navigation Bar Dropdown Feature

I attempted to divide the dropdown menu in the navigation bar into two columns, but they are overlapping with each other.

Another issue I noticed is that the Search bar remains at the bottom on mobile devices and the page does not respond properly. I am unsure if this problem is related to the navigation bar issue. Any suggestions or advice would be greatly appreciated. Wishing everyone a fantastic weekend!


        html {
          position: relative;
          min-height: 100%;
        }
        body {
          margin-bottom: 60px;
        }

        section {
          padding: 70px 0;
          border-bottom: 1px dotted #ccc;
        }
        .grid-example div[class^="col"] {
          border: 1px solid white;
          background: lightblue;
          text-align: center;
          padding-top: 8px;
          padding-bottom: 8px;
        }
        .jumbotron {
          background-color: lightskyblue;
        }
        table th {
          text-align: center;
        }
        .table {
          margin: auto;
          width: 50% !important;
        }
        .table td {
          text-align: center;
        }
        .footer {
          position: absolute;
          bottom: 0;
          width: 100%;
          height: 60px;
          line-height: 60px;
          color: #fff;
          text-align: center;
          background-color: #C0C0C0;
        }
        a {
          color: #f00;
        }
        a:hover {
          color: #0f0;
        }
      
    

        <!doctype html>
        <html lang="en">

        <head>
            <!-- Required meta tags -->
            <meta charset="utf-8">
            <meta http-equiv="X-UA-Compatible" content="IE=edge">
            <title>Test</title>
            <meta name="description" content="Test">
            <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
            <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous">
            <link rel="stylesheet" href="Sticky Footer.css">
        </head>

        <body>

            <nav class="navbar-expand-sm navbar-expand-md navbar-expand-lg navbar navbar-light" style="background-color: #C0C0C0;">
                <a class="navbar-brand" href="#">Navbar</a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavDropdown" aria-controls="navbarNavDropdown" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>
                <div class="collapse navbar-collapse" id="navbarNavDropdown">
                    <ul class="navbar-nav">
                        <li class="nav-item active">
                            <a class="nav-link" href="#">Test <span class="sr-only">(current)</span></a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Test</a>
                        </li>
                        <li class="nav-item">
                            <a class="nav-link" href="#">Test</a>
                        </li>
                        <li class="nav-item dropdown">
                            <a class="nav-link dropdown-toggle" href="#" id="navbarDropdownMenuLink" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"> Test </a>
                            <div class="dropdown-menu" style="width:300px" aria-labelledby="navbarDropdown">
                                <div class="container container-sm">
                                    <div class="row">
                                        <div class="col-sm-4">
                                            <a class="dropdown-item" href="#">Test Test Test</a>
                                            <a class="dropdown-item" href="#">Test Test</a>
                                            <a class="dropdown-item" href="#">Test</a>
                                        </div>
                                        <div class="col-sm-4">
                                            <a class="dropdown-item" href="#">item item item item</a>
                                            <a class="dropdown-item" href="#">item item item item item</a>
                                            <a class="dropdown-item" href="#">item</a>
                                        </div>
                                    </div>
                                </div>
                            </div>
                        </li>
                    </ul>
                </div>
            </nav>

            <div class="jumbotron">
                <h1 class="display-8">Hello, World!</h1>
                <p class="lead-8">This is a simple hero unit, a jumbotron-style component for highlighting featured content or information.</p>
      
                <p class="lead">
                    <a class="btn btn-primary btn-md" href="#" role="button">Learn More</a>
                </p>
            </div>

            <div class="row align-items-center" style="min-height: calc(100vh - 500px)">
                <div class="col-xs-3 col-sm-8 col-md-6 col-lg-6 mx-auto">
                    <div class="input-group-prepend">
                        <input id='urlurl' type="url" class="form-control" placeholder="Search" pattern="https?://.+" required />
                        <span class="input-group-btn">
                            <button class="btn btn-primary" style="background-color: #0275D8; border-color: #0275D8;" type="button">Test</button>
                        </span>
                    </div>
                </div>
            </div>

            <footer class="footer fixed-bottom text-center">
                <span class="text">Place sticky footer content here.</span>
            </footer>

            <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script>
            <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script>

        </body>

        </html>
      
    

Answer №1

Let me address the dropdown query related to the title. It's important not to nest a container within the dropdown. Also, increase the min-width of the dropdown to accommodate the content.

Check out this link for reference

       <div class="dropdown-menu" style="min-width:360px" aria-labelledby="navbarDropdown">
                <div class="row no-gutters">
                    <div class="col-sm-6">
                        <a class="dropdown-item px-2" href="#">Test Test Test</a>
                        <a class="dropdown-item px-2" href="#">Test Test</a>
                        <a class="dropdown-item px-2" href="#">Test</a>
                    </div>
                    <div class="col-sm-6">
                        <a class="dropdown-item px-2" href="#">itemitemitemitem</a>
                        <a class="dropdown-item px-2" href="#">itemitemitemitemitem</a>
                        <a class="dropdown-item px-2" href="#">item</a>
                    </div>
                </div>
       </div>

In Bootstrap 4, there is no longer col-xs-*; it has been replaced with just col-*.

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

Steps to fully eliminate the recent action panel from Django's administrative user interface

Is there a way to completely remove the recent action panel from Django admin UI? I have searched extensively but all the information I find is about clearing the data in the panel from the database. What I'm looking for is a way to entirely eliminate ...

Creating personalized styles for my React components with the help of styled-components

Exploring the power of styled-components for custom styling on child components has been an interesting journey for me. For instance, I recently crafted a unique card component named myCard. Take a look at how it's structured: import React from "rea ...

A see-through section with a border that fades in transparency

Can anyone help me with creating a box with a unique design using CSS only? I want the box to have a rounded border that starts at 80% opacity at the top and gradually fades to 20% opacity at the bottom. Additionally, the border should start at 80% opaque ...

Learn how to incorporate a newly created page URL into a customized version of django-oscar

Just starting out with django-oscar and trying to set up a new view on the page. I've successfully created two pages using django-oscar dashboard, https://ibb.co/cM9r0v and added new buttons in the templates: Lib/site-packages/oscar/templates/osca ...

Utilizing AngularJS, implement ng-form and ng-repeat to seamlessly handle input validation and submission actions

Angular 1.6.2 I am experimenting with iterating over elements of a collection inputted by the user, checking their validity, and enabling the submit action if validation passes. I have tried using ng-form for this purpose and have come up with two differ ...

Reload the text content of a locally hosted webpage within an iframe at regular intervals

I have set up a simple webpage on my local machine to showcase the contents of some text files on a dedicated monitor. However, I am facing an issue where refreshing the entire webpage causes flickering. My goal is to only refresh the iframes and reload t ...

Storing the CSS styling for a unique directive in its own dedicated file

Currently exploring Angular and seeking guidance on the most effective methods, as well as a general roadmap for delving deeper into the topic: In my efforts to develop a web application with Angular consisting of various independent widgets, I have opted ...

Javascript Object and Conditional Statement

I am working on a Dygraph object creation script that includes a data variable. However, I want to avoid passing in this variable for older browsers. Here is the code snippet: function prime() { g = new Dygraph( document.getElementById("g"), d ...

Provide a value for a secondary select option parameter

I need to retrieve the university ID for use in another select option, which will display my college list under a specific university from a MySQL database. However, I am struggling to find the right approach. I want to pass fetch.university_id as a parame ...

Visual Studio 2017 experiencing compatibility issues with Bootstrap

I've been working on creating a carousel using bootstrap within Visual Studio 2017. I utilized the NuGet package manager to install jQuery and Bootstrap, and to test its functionality, I generated a bootstrap snippet for the carousel. Take a look at ...

Troubleshooting issue with Onchange in select HTML element within Django

I'm working with a Problems model in my project. In my Models file models.py class Problems(models.Model): Easy = 'Easy' Medium = 'Medium' Hard = 'Hard' NA = 'NA' DIFFICULTY = [ (NA ...

The tabs are visible in the drawer, but the transition is not occurring

I am a beginner when it comes to using material ui. After clicking on advanced sports search, a drawer pops up. I have been trying to incorporate tabs in the drawer, but every time I click on tab two, the drawer closes. In reality, it should switch between ...

Using Quill with express and Node.js can greatly enhance the user experience of

I am encountering issues with displaying the Quill editor on my website. My project consists of two ejs files - a layout file and an add_new file which includes the layout. The layout.ejs file is as follows: <div class="snippet" data-lang="js" data-h ...

Unusual behavior observed when calculating in Angular

Utilizing Angular.js, I dynamically calculate the height and add the value to the CSS style attribute within an ng-repeat loop. The issue arises with this particular line of code: <div style="height: {{60.0 / 100.0 * (100 - (100.0 / 0.27 * (item.wert ...

Creating a display of divs that flow from left to right in each row, and then stacking the rows from bottom to top using CSS and jQuery

My current dilemma involves a collection of divs that must be displayed in a specific order, but with a rather intricate layout. Essentially, this is the structure of my HTML: <div> <div class="box">1 (first in list)</div> <di ...

How to toggle visibility of previous and next elements in a Laravel carousel

Just starting out with Laravel and Bootstrap. I'm attempting to showcase database data in a carousel format. Within the database, I've populated a few rows with text which I'd like to display on individual slides. My goal is for one row/sl ...

Safari not rendering SVG wave at full width reached

My SVG isn't scaling to 100% width in Safari like it is in IE, Chrome, and Firefox. Despite numerous attempts, I haven't been able to make my SVG stretch across the full width like it does in other browsers. The project is built using React. . ...

Embedding a table inside a Bootstrap popover

I'm struggling with adding a table inside a Bootstrap popover. When I click on it, the table doesn't show up. This is my first time trying to insert HTML into a popover, so I don't know the correct way to do it. Any help would be appreciated ...

The toast feature in Bootstrap 5 seems to be malfunctioning as it does not display properly despite the absence of any

Why isn't the Toast displaying in the code snippet below? I'm using bootstrap 5. I'm puzzled because there are no errors in the developer's tools. Any assistance would be greatly appreciated. <!DOCTYPE html> <html lang="en"& ...

What is the best way to show the result of a PHP form in an HTML page when the PHP processing is on a different page, without relying

Imagine having a form located in the file called form.php. <form action="process.php" method="POST"> <input type="text" name="message"> <input type="submit" value="Submit"> </form> <span class="result"></span> The proc ...