Issue with Bootstrap: Navbar elements shifting when page width is decreased

I am facing an issue with my two navbars, one above the other. The top bar is thinner and consists of two navigation items aligned to the right of the page. Despite setting it not to collapse when the page width is reduced, the items suddenly disappear when the width is decreased too much. It seems like they are moving behind the lower navbar.

My goal is to keep these two navigation items static on the page regardless of the width.

Custom CSS:

body {
    padding-top: 105px;
}

.navbar-top-custom {
    height: 28px;
    background-color: rgba(32, 32, 32, 1);
}

.navbar-bottom-custom {
    margin-top: 28px;
    height: 56px;
    background-color: rgba(53, 53, 53, 1);
}

.navbar-top-custom .nav-item{
    color: rgb(211, 211, 211) !important;
    font-size: 12px;
    font-family: "Helvetica Neue", Helvetica, sans-serif;
}

HTML:

<nav class="navbar navbar-expand-sm navbar-top-custom fixed-top">
    <ul class="nav ml-auto">
        <li class="nav-item">
            <a class="nav-link" href="#"><i class="fas fa-question-circle" style="padding-right: 5px"></i>  Knowledge Base</a>
        </li>
        <li class="nav-item">
            <a class="nav-link" href="#"><i class="fas fa-user-circle" style="padding-right: 5px"></i>  Client Login</a>
        </li>
    </ul>   
</nav>

Full Screen Screenshot:

https://i.sstatic.net/m3FE6.jpg

Reduced Width Screenshot:

https://i.sstatic.net/1Oh5T.jpg

Edit:

Upon investigating, Bootstrap seems to stack the <li> elements vertically when the resolution is reduced. Is there a way to prevent this behavior?

https://i.sstatic.net/dipeg.jpg

Answer №1

It seems like the problem lies in the height property applied to your .navbar-top-custom element. I suggest removing the height and adjusting the padding on the <nav> or <a> elements instead.

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 disable the save option on a PDF popup window?

When displaying a PDF using an embed tag, I have managed to disable print and content copying through document properties. However, I am struggling to find a solution to disable the save option that pops up. Is there a way to achieve this using JavaScrip ...

Switch up the icon upon clicking

I attempted to implement a spinner that would display when downloading a file. Unfortunately, the spinner appears for all files in the table row when only the intended file should show it. File download link before clicking: https://i.sstatic.net/yp7XO.j ...

How can you reduce the size of the bootstrap navbar without utilizing less?

I've been attempting to reduce the height of Bootstrap 3.1.1's navbar without utilizing the less version. Despite trying various methods from different sources, I haven't been able to decrease the CSS's .navbar height. However, I did m ...

Chrome's struggle with displaying multiple backgrounds on retina screens due to CSS complications

My goal is to create top and bottom shadows for a parent container when scrolling through the content. This effect works perfectly everywhere except on Chrome browser with retina screens, where it behaves strangely. The background becomes stuck at the top, ...

Preventing Bootstrap 4 slider images from shifting position when using background-attachment:fixed for a parallax effect

I'm trying to implement a Parallax scrolling effect on my Bootstrap 4 slider. However, every time the slider switches to the next image, the image needs to readjust itself into place. How can I avoid this? .customOverlayText { position: absolute; ...

Creating a dropdown button with three dots in a table row using jQuery

I've been working with tables and I'm trying to create a dropdown list with 3 dots in each table row. I've experimented with a few libraries and custom dropdown options, but none of them seem to be working properly. What I'm looking fo ...

How can the title of a link be hidden in a popup panel?

Seeking assistance for a popup panel issue. When you click on the black ffff button, a popup panel appears with the text ffff having a blue shadow in the top left corner that disappears when clicked. How can I remove this? Here's the link: <a class ...

When a click event triggers, use the .get() method in jQuery to retrieve the content of a page and then update

I am currently facing an issue with a div class="contentBlock", which is acting as the container for updating content. <div class="contentBlock"></div> Unfortunately, the script I have written does not seem to be working properly :c $(docume ...

Only initiate the loading of the iframe within the div upon clicking a specific element

Is there a way to delay loading the content of a div until it's clicked, instead of having all data loaded at once when the page loads? I noticed that removing unnecessary divs made the page load much faster. How can I prevent all data from being loa ...

Utilize the Tab key in Textarea fields to insert a tab character ( ) instead of navigating to the

My current issue involves utilizing an HTML textarea named userInput. Whenever I press the tab key, it simply shifts focus to the next element instead of inserting a tab character or some spaces within the textarea. Is there a way for me to configure the ...

Modify the background of a div according to the size of the screen. Implement this functionality using JavaScript and

After reviewing a specific post at , I find myself unsure of how to target a particular class for reference. I am certain that I want to implement document.onload = checkWidth(); window.onresize = checkWidth(); However, I am uncertain about the procedur ...

Switching from real pixels to CSS pixels

The details provided in Mozilla's documentation on elementFromPoint clarify that the coordinates are specified in "CSS pixels" rather than physical pixels. This raises a question about what exactly CSS pixels entail. Many assume that a pixel in CSS is ...

Tips for streaming wma files in html (windows media files)

Is there a way to stream Windows Media files in HTML without downloading the file? I have tried using HTML audio and embedded tags, but WMA files are not supported. <audio controls="mycontrol" height="50" width="50"> <source src="music.mp3" type ...

Dynamic grid in Bootstrap functioning flawlessly with the generation of all elements except one

I'm currently working on creating a dynamic grid for video components, but I'm facing a challenge. I'm struggling to figure out how to handle an element that is not generated dynamically. The first video element is created conventionally, wh ...

What is the function of table widths in accommodating wider details during insertion?

What happens when a detail width is set to <td width="10"...> and something wider, like a picture that is 20 pixels wide, is placed in that detail? ...

Achieve alignment of span and h3 elements in one line

I'm having a bit of trouble with a simple task. I want my span and h3 elements to display on the same line, side by side. However, they are currently appearing on separate lines. Can anyone provide some guidance on how to resolve this issue? header ...

Button elements are not responsive to Bootstrap margin classes

I am facing an issue in my code where adding the class m-0 to a button is not working to reduce the margin around it to 0. However, when I include .close {margin:0;} in my SCSS file, it successfully reduces the margin to 0. Even though I was advised agains ...

Using Selenium to verify that a textarea is empty when clicked on

I am currently utilizing Selenium with Python to write a functional test. My goal is to verify that when a user clicks on a textarea, its content is cleared. Below is the HTML code for the textarea: <textarea id="id_textarea" cols="50" rows="10" oncli ...

What is the correct way to insert a Vimeo video into an HTML document?

When embedding a YouTube video in HTML, the <iframe src="https://youtube.com/embed/videoId> element is used. But what about when you want to embed Vimeo videos using the <iframe> element? ...

Creating a PHP script to generate a response for an AJAX request

I'm struggling with a logical issue in my script. The goal is to format some rows in a table without repeating the header, and then outputting all items as a variable passed to AJAX. However, I'm unsure of how to tackle this problem. function a ...