Please create the navigation links below the login form

I am working on creating a navigation bar that includes both a login form and menu links. However, the issue I am facing is that the output shows them horizontally aligned rather than having the menu links below the login form.

I specifically want the menu links to be positioned below the login form, but the current layout is not displaying as intended.

Here is the CSS code:

.nav-link {
    font-size: 18px !important;
    text-transform: uppercase !important;
    font-weight: 600 !important;
}
.navbar-light .navbar-nav .nav-link {
    color: #ffff !important;

 }

 #search { margin: auto; }
 body {
     overflow-x: hidden;
 }

And here is the HTML structure:

<!DOCTYPE html>
<html lang="en">
<head>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, 
    maximum-scale=1, user-scalable=no">
    <title></title>
    <!-- favicon -->
    <meta name="msapplication-TileColor" content="#ffffff">
    <meta name="theme-color" content="#ffffff">
    <!-- /favicon -->
    <link href="/realcss/bootstrap-4.1.3.min.css" type="text/css" rel="stylesheet">
    <link href="/realcss/flag-icon.min.css" type="text/css" rel="stylesheet">
    <link href="/realcss/fontawesome-all-5.3.min.css" type="text/css" rel="stylesheet">
    <link href="/css/layout.css" type="text/css" rel="stylesheet">      
</head>
<body>

    <!-- navigation.tpl -->
    <header>

        <nav class="navbar navbar-expand-md navbar-light fixed-top bg-dark border-bottom" style="float: right;">
            <a class="navbar-brand" href="#"><img class="logo" src="/images/logo/M.png" style="max-width: 400px;
        max-height: 64px;" alt=""></a>
            <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarCollapse" aria-controls="navbarCollapse" aria-expanded="false" aria-label="Toggle navigation">
                <span class="navbar-toggler-icon"></span>
            </button>
            <div class="collapse navbar-collapse justify-content-center" id="navbarCollapse">
                <div id="search">
                    <form class="d-flex justify-content-center align-items-center form-inline my-2 my-lg-0">
                        <div class="col-auto pl-0">
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text"><i class="fa fa-user"></i></div>
                                </div>
                                <input type="email" class="form-control" id="exampleInputEmail1" aria-describedby="emailHelp" placeholder="Email Address">
                            </div>
                        </div>
                        <div class="col-auto pl-0">
                            <div class="input-group">
                                <div class="input-group-prepend">
                                    <div class="input-group-text"><i class="fa fa-lock"></i></div>
                                </div>
                                <input type="password" class="form-control" id="inlineFormInputGroup" placeholder="Password">
                            </div>
                        </div>
                        <div class="col-auto pl-0 pr-0">
                            <button class="btn btn-primary my-2 my-sm-0" type="submit">Login</button>
                        </div>
                    </form>
                </div>
                <ul class="navbar-nav d-flex justify-content-center">
                    <li id="li-home" class="nav-item active">
                        <a id="link-home" class="nav-link" href="#">Home<span class="sr-only">(current)</span></a>
                    </li>
                    <li id="li-about" class="nav-item">
                        <a id="link-about" class="nav-link" href="#">Link</a>
                    </li>
                    <li id="li-team" class="nav-item">
                        <a id="link-team" class="nav-link" href="#">Link</a>
                    </li>
                    <li id="li-news" class="nav-item">
                        <a id="link-news" class="nav-link" href="#">Link</a>
                    </li>
                    <li id="li-contact" class="nav-item">
                        <a id="link-contact" class="nav-link" href="{{ route('promotion') }}">Promotion</a>
                    </li>
                </ul>
            </div>
        </nav>
    </header>
</body>

Answer №1

Check out this CSS snippet:

.navbar-expand-md .navbar-collapse{
    flex-direction:column;  
  }
  

See it in action

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 CSS method for changing the content URL is experiencing difficulties in Firefox

Css: .woocommerce-placeholder.wp-post-image { content: url("DSC0926-1.jpg"); } /*for firefox*/ .woocommerce-placeholder.wp-post-image::before { content: url("DSC0926-1.jpg"); } HTML <img src="placeholder.png" alt="Placeholder" class="woocomm ...

When a user chooses a file name from a DropDown-List control, automatically direct them to a new page

Here is the code in .aspx: <form id="form1" runat="server"> <div> <asp:DropDownList ID="DropDownList1" runat="server"> <asp:ListItem value="">About Us</asp ...

Is it possible to use animate.style for hover animations?

I am interested in utilizing animate.style to display animation effects on hover rather than on page load. The new version of animate.css, known as animate.style, does not appear to have the hover functionality mentioned in its documentation. I am unsure ...

Navigate to the top of a Bootstrap accordion when it is expanded

Recently, I've been working on a small blog and I want to make consecutive blog posts accessible from within an accordion. This will allow users to easily skim through post titles, select the one they find interesting, read it, and seamlessly go back ...

The bootstrap icon is not loading on the web page, even though it is present

After successfully downloading npm install bootstrap-icons --save, I found it in the node_modules folder. However, when I try to include it in my HTML file, the icon does not appear unless I use a hyperlink. Not working one <link type="text/css&q ...

Unable to update the information within a DIV using Python Django, as well as the webpage following a jQuery action

Exploring new ideas through the lens of two variables in an HTML template, messages and users, a series of buttons trigger a jQuery function upon being clicked. This function sends a post request to a Django server, which then returns an update to the mess ...

What is the best way to choose a range of nodes with dynamic limitations without relying on static positions?

<li></li> <th> <li></li> <strong>"Jeff"<strong> <li></li> <a>"Mary"<a> <li></li> <th> <li></li> <strong>"Rich"<strong> <li></li&g ...

Icon in navigation dropping down and moving to next line

Trying to use Bootstrap 4 and dropdown-toggle:after to display siblings as a wordpress menu. The issue is that I can't seem to keep the carrot on the same line as the text on smaller screens. https://i.sstatic.net/rJBM5.png Check out the code snippe ...

Intercepting the initialization process of a web application created with Angular-CLI

Is there a way to delay the bootstrapping process of an Angular-CLI app in order to allow a loading animation to finish before rendering the actual content? Currently, when the root component is bootstrapped, any CSS animations are automatically removed fr ...

Challenges encountered with the login page within the script document

I am struggling to make this simple code work. Here is the code snippet I am working with that needs to list two user names along with their selected passwords. While I understand hardcoding in the script is not ideal, it is required for this assignment. ...

The dark mode class in Next.js/React does not take effect until a local change is made

I've been diving into a helpful tutorial on implementing dark mode toggle in my project. The tutorial uses react-toggle and can be found here. Everything seems to be working fine except for one issue that arises on the initial page load. When the bro ...

Navigation menu and ribbons malfunctioning on Internet Explorer

Currently facing two issues in Internet Explorer. The first involves my navigation menu where the links are stacking vertically instead of horizontally on the bar. Below is the code for the nav menu. HTML <div class="main-navigation" role="navigation" ...

Apply box shadow to a transformed box

I have been working on creating a three-dimensional book using only CSS. I am now at the final stage, where I need to add box-shadow to it. How can I apply box-shadow:10px 10px 30px rgba(0,0,0,0.3) to achieve the desired effect? Should I make adjustments ...

Customizing a Google chart legend to show on hover event

Utilizing the Google Chart API, I have created a line chart to display my data. To customize the legend, I initially set the chart's original legend to none and then designed my own legend according to my preferences. While everything is functioning ...

ways to conceal the default icon in bootstrap navbar

I am looking to incorporate Bootstrap tags into my HTML file in order to display my menu items. However, I want to avoid having the default navbar highlight box and hamburger icon appear when users visit my site using a tablet or mobile device. <nav cl ...

Attempting to implement CSS onto jQuery slideToggle upon the clicking of links

Need to implement a show/hide functionality for a series of lists using jQuery slideToggle. After clicking on the hyperlinks that trigger the show/hide action, I want to change the CSS style of those hyperlinks and then revert back to the original style up ...

The rendering of CSS is altered when being processed by IIS

It appears that this issue is not specific to any browser and generally affects styling in various webkit/gecko/mozilla styles. For instance, when I create a website mockup and implement a style like: element.class { border-radius: 5px; -moz-bor ...

A collection of items that mysteriously affix themselves to the top of the page as

Unique Context In my webpage, I have a specific div element with the CSS property of overflow: auto. Within this scrolling div, there is structured content like this: <h3>Group A</h3> <ul> <li>Item 1</li> <li>I ...

Using a glyphicon will change the dimensions of the text box

I am currently working on a Bootstrap web page that features a list box filled with names and a search box for filtering through those names. The search box includes a glyphicon-remove button that becomes visible when text is typed in. Clicking the button ...

Mobile Apps Plagued by Frozen Preloader Gif Images

Working with jQueryMobile(1.3.1) and Phonegap(2.7.0) for developing Android and iPhone applications has presented me with a challenge regarding the Preloader Image. I am currently using a Gif image as my preloader. The custom function I am using for the p ...