How to position two Bootstrap 4 Navbars side by side

I'm currently experiencing an alignment issue with two stacked navbars in my code. I want to align the upper navbar with the lower one, but I've tried various approaches without much success. Is there a problem with the buttons or something else that's causing this misalignment? Any assistance would be greatly appreciated! https://i.sstatic.net/9s2jA.jpg https://i.sstatic.net/vNiYG.jpg

<nav class="navbar navbar-expand-md">
    <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a href="#">
                        <img src="F:/Theme Development/New folder/facebook.png" style="margin-right:2rem;vertical-align:text-top;height:55px;" />
                    </a>
                </li>

                <li class="nav-item">
                    <a href="#">
                        <img src="F:/Theme Development/New folder/instagram.png" style="margin-right:2rem;vertical-align:text-top;height:55px;" />
                    </a>
                </li>

                <li class="nav-item">
                    <a href="#">
                        <img src="F:/Theme Development/New folder/linkdin.png" style="margin-right:2rem;vertical-align:text-top;height:55px;" />
                    </a>
                </li>

                <li class="nav-item ">
                    <a href="#">
                        <img src="F:/Theme Development/New folder/twitter.png" style="margin-right:2rem;vertical-align:text-top;height:55px;" />
                    </a>
                </li>


                <li class="nav-item">
                    <a class="btn btn-primary" style="background-color: #685dadfa;border:0px;border-radius:0px;font-size:30px;font-family: inherit"
                        href="#">
                        <img src="F:/Theme Development/New folder/lock1.png" style="vertical-align:sub" /> REGISTER</a>
                </li>
                <li class="nav-item">
                    <a class="btn btn-primary" style="margin-left:1rem;background-color: #179c95;border:0px;border-radius:0px;font-size:30px;font-family: inherit"
                        href="#">
                        <img src="F:/Theme Development/New folder/sign_in.png" style="vertical-align:sub;" /> LOG IN</a>
                </li>
            </ul>
        </div>
    </nav>

    <nav class="navbar navbar-expand-md navbar-light" style="background-color:white">

        <a class="navbar-brand mb-0 h1" style="font-family:Cambria, Cochin, Georgia, Times, 'Times New Roman', serif" href="#">Website Logo</a>

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

        <div class="collapse navbar-collapse" id="navbarSupportedContent">
            <ul class="navbar-nav ml-auto">
                <li class="nav-item">
                    <a class="nav-link" href="#">Home
                    </a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Post a Job</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Post Resume</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Blog</a>
                </li>
                <li class="nav-item">
                    <a class="nav-link" href="#">Contact Us</a>
                </li>
            </ul>
        </div>
        </div>
        <!--/div-->
    </nav>

Answer №1

Check out the padding around the <a> tags, highlighted in green in the image below:

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

To ensure the "Contact Us" text aligns with the "Log in" button on the right side, simply include padding-right: 0; in the style of the <a> for "Contact Us"

            <li class="nav-item">
                <a class="nav-link" href="#" style="padding-right:0;">Contact Us</a>
            </li>

https://i.sstatic.net/UMUUw.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

Is it possible to verify the absence of an error icon when valid data is provided in Angular testing?

Currently, I am utilizing the Selenium webdriver for Angular Automated testing. My scenario involves displaying a tooltip icon with an error message if the data provided is invalid. If the data is valid, the tooltip icon does not show up. Although, I have ...

Closing an Electron Dialog triggers a refresh on my current page

I currently have an Electron application in place. It utilizes Bootstrap v4, Electron v2, as well as other node modules. One concern I am facing is related to a button that triggers an Electron dialog box where users can select a folder. Upon selecting th ...

I'm seeking answers on selenium and the proper use of CSS selectors, as well as troubleshooting the error message 'selenium.common.exceptions.ElementClickInterceptedException'

After some research, I think I have a grasp on CSS selectors and their appearance. However, when using selenium, how can I locate a CSS selector on a website and then click on it? The correct syntax eludes me. I encountered this error as well: selenium.co ...

The overflow of CSS text selection color spills beyond the boundaries of the box

I'm just starting to learn CSS and was wondering if there is a way to prevent the text selection color from extending into the 'gutter' (I believe that's the correct term) like shown here: It may seem trivial, but I've observed th ...

"Subtle Website Background Fade Effect When Menu is Hovered Over

Click on the following link to observe a transition effect that occurs on the body of the website when interacting with the main menu system: Here is the website Do you know what this effect is called and how it can be integrated into a website? ...

What is the best way to resize an image in HTML based on a percentage of its height?

Within my HTML code, I have a PNG image that has been adjusted in size using CSS: .adjust-image { border:1px solid #021a40; display: block; width: auto; max-width: 100%; max-height: 1000px; } .img-container { position: relative; } ...

When would using <style> be more appropriate than using a css file?

Is it necessary to use the style element when you can simply write in the CSS file? Are there any circumstances where using 'style' is more beneficial than the CSS file? ...

Is there a way to trigger the bootstrap datetimepicker when a custom button is clicked, while also storing the selected value in a hidden textbox

When the ADD button is clicked, a datetimepicker should open. After selecting a value from the datetimepicker, it should be saved in the textbox with ID #myTextBox. <div> <input id="myTextBox" type="text" ng-model="c" data-provide="datepicker ...

Bootstrap version 5.3.0 has a unique behavior where dropdowns placed outside the collapsed area of the navbar will display the menu inside the navbar, rather than outside

Is there a way to fix the issue where the dropdown menu appears in the body of the navbar when it is collapsed? I have tried using attributes like data-bs-reference but couldn't find much information on how to resolve this. <nav class="navbar ...

Adjusting the Underline Navigation Effect with jQuery

My current setup includes a basic navbar with an up arrow that slides underneath it when a navigation title is clicked. The arrow initially rests between two nav titles, and when one of them is clicked, some text also slides in. I am looking to implement ...

Transferring a JavaScript element's ID to PHP

Recently, I came across a JavaScript function that automatically updates the date and time for me. I found the script on this URL: http://jsfiddle.net/pLsgJ/1/ setInterval(function() { var currentTime = new Date ( ); var currentHours = curren ...

The image is not properly aligned with the background image

I'm currently working on a page design using bootstrap and css where I want images to fade and reveal the background when hovered over. The challenge I'm facing is that although all images are set to 100px in size, there is white space visible ar ...

Stacking of div elements is not possible when they have a position relative

To summarize, I created a container div (parent) with a relative position and then added 3 children divs with absolute positions. Now, I am attempting to add another div that should appear below all of this content, essentially representing the next sectio ...

Unable to see the changes made to the Understrap child-theme and the color variable in Sass is not

I am trying to adjust the main theme color assigned by $primary in _theme_variables.scss. I changed the default value from $purple to $orange while using npm run watch-bs (browser-sync). However, the change is not reflecting on the home page: https://i.ss ...

Creating a scrollable nested div on a mobile website

Is there a way to achieve a scrollable nested div on a jQuery mobile site? I am aiming for a fixed header and footer with the middle section being scrollable. Despite my attempts to set overflow:scroll (along with specifying the width and height of the div ...

What is the best way to eliminate the gap between header, content, and footer sections when in mobile view?

This issue seems to only occur in mobile mode, where the blueviolet line is coming from the background color. https://i.stack.imgur.com/VBhIp.png link to the image body { background-color: blueviolet; } header, main, footer { background-color: #ff ...

Issue with Dynamic Theming in Ionic Framework

Currently, I am using Ionic in combination with Angular to create an App. I have introduced dynamic theming by adding two .scss files into my theme folder. In my app.scss file, I define the layout of components without colors, while all color styles are st ...

After my data rows are filled, I add jQuery and CSS striping animations to enhance their appearance

Before any click, they have this appearance: Clicking on Sales in the business section reveals a drop-down select box. If I click on "Sales" and modify the text area, it will transition to grey. While the grey rows change accordingly, the black rows shoul ...

Building a Sleek Hover Effect Dropdown Menu Using HTML and CSS

I've been following a tutorial on YouTube that showcases how to create a hoverable dropdown menu using HTML and CSS. The video link can be found below: Youtube Video Tutorial: https://www.youtube.com/watch?v=9Qrs8p7WgCc After replicating the code an ...

Increase the Step Size of an HTML Number Input by Holding Down the Time

Is there a way to implement increasing increment/step size for number inputs in HTML based on how long the user holds the stepper arrows? For instance, starting at step size=1 and gradually ramping up to larger increments like 5, 10, 20, etc. after holdin ...