Why is my Bootstrap 4 NavBar displaying a mysterious blank space on the right?

Kindly look at the image provided. The issue of white space only appears on the full-screen webpage, not on mobile or tablet views.

/**** Nav Bar elements**/

.navbar{
    z-index: 1;
    width: 100%;
    margin: 0;
}
.navbar-default{
  background-color: rgb(206, 206, 206) !important;
}
.navbar-brand{
    font-family: "Luckiest Guy", cursive;
    padding-left: 30px;
}
.nav-link{
    font-family: "Luckiest Guy", cursive;
}
.navbar .navbar-brand:hover {
    color: #971491;
}

.navbar-light .navbar-nav .nav-link.active,
.navbar-light .navbar-nav .nav-link:hover {
    color: #971491;
}


.bg-light {
    color: rgb(206, 206, 206);
}
<nav class="navbar navbar-expand-lg navbar-light bg-light">
  <a class="navbar-brand" href="index.html">Match-The-Tech</a>
  <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarNavAltMarkup" aria-controls="navbarNavAltMarkup" aria-expanded="false" aria-label="Toggle navigation">
    <span class="navbar-toggler-icon"></span>
  </button>
  <div class="collapse navbar-collapse" id="navbarNavAltMarkup">
    <div class="ml-auto navbar-nav">
      <a class="nav-item nav-link active" href="index.html" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">How to Play <i class="fas fa-question"></i> <span class="sr-only">(current)</span></a>
      <br>
      <a class="nav-item nav-link" href="card.html" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">Play Game <i class="fas fa-play"></i></a>
      <br>
      <a class="nav-item nav-link" href="settings.html" data-bs-toggle="collapse" data-bs-target=".navbar-collapse.show">Settings <i class="fas fa-cog"></i></a>
    </div>
  </div>
</nav>

Link to Image Showing Space in Top Right Corner

Answer №1

To create a fixed navbar, include the position: fixed; property in the .navbar class. Additionally, add any other required styles.

.navbar{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    margin: 0;
    z-index: 1;
}

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

Tips for selecting array [0] and turning it into a clickable link with JavaScript

My challenge lies in redirecting to a different URL when the user clicks on <a href="javascript:void(0)">Hotel Selection</a>. Below is my current progress. Grateful for any assistance! <div id="menu"> <ul> <li class= ...

Troubleshooting Bootstrap: Issues persist even after including CDN links and reference style link // Python

Currently, I'm in the process of constructing my Django app. After successfully implementing the login page and homepage, I decided to give my page a much-needed facelift since it looked extremely basic. A big fan of Bootstrap, I've used it exten ...

Load data into Handsontable using AJAX when the site is freshly loaded

Could you please clarify the reason behind the functionality of this code: $(document).ready(function () { var container = document.getElementById('example'); function fetchData() { var dataResult = null; $.ajax({ ...

Siblings mousedown event propagation

In my HTML code, I have a division that contains multiple image objects with the position set to absolute. Here is an example: <div> <img> <img> <img> <img> </div> The problem arises when the ...

Is there a way to create a marker that changes color when hovering over the text directly below it?

Hi everyone, I hope you're all doing well. Currently, if you hover over the marker, it changes color. However, I want this effect to apply when hovering over the text below as well. Is there a way to create a connection between these two div elements? ...

Django plugin designed for showing a real-time feed of messages - powered by Dajax or Jquery?

Currently, I am attempting to set up a section in my Django application where updates or messages from the server can be displayed once specific tasks are done. I had initially looked into using a plugin that utilizes Dajax / Jquery for this feature, but ...

How can I use JavaScript and HTML to print a canvas that is not within the print boundaries?

As someone who is new to javascript, I recently created a canvas function that allows me to successfully print. However, I am encountering an issue with printing large canvas areas. When I navigate to the further regions of the canvas and try to print, i ...

Picture not adapting correctly to various screen sizes

I'm looking to adjust the size of an image based on the user's browser window. Here is the code I have so far: .image { max-height: 15%; width: auto; } The image class is used in this section of my code: <ul> <li> <img c ...

Allow entry fields and a submit button to become active once the form has been submitted on ASP.NET MVC 4

I want the update button to be activated after submitting the form. Take a look at my code: VIEW: @using (Html.BeginForm("ProcessTech", "Home", FormMethod.Post)) { @Html.TextBoxFor(m => m.techNo, new { @class = "form-control maintain-t ...

Tips for implementing a CSS override for a block element's relative date

I am looking to customize this source code by using a CSS override to ensure that the "lightning-relative-date-time" element is not utilized. I want to keep it displaying the timestamp information by default. Can you guide me on how to achieve this throu ...

Error in Rails app when incorporating Stripe API with Javascript involved

Incorporating Stripe into my rails app using the Koudoku gem has been challenging. When attempting to load the page for capturing user credit card information, I encounter an error in my JS console: Uncaught ReferenceError: $ is not defined (anonymous fun ...

The issue with uploading files through ajax and jquery persists

I need to send the form using ajax. The form includes a text input field and a file upload field. However, in the ajax page (formaction.php), the file details are not being received. HTML <form method="post" id="newform" enctype="multipart/form-data"& ...

Determining the exact position of an absolute element within a Bootstrap container

In my design, I am using a full-width cover image with a bootstrap container class containing an absolutely positioned image on top of the cover image. My goal is to have this image positioned exclusively on the right-hand side of the container. Below is ...

Extract the height of children from the height of their parent

Hey there! I recently discovered a fantastic plugin that helped me achieve equal heights for all the divs on my website. If you're interested, you can check out the plugin here. $('.item-container').responsiveEqualHeightGrid(); However, I& ...

Showing hidden JavaScript elements in different parts of a webpage

Update: After making modifications to my JavaScript code, I am now encountering errors in the iPhone Debug Console. Disclaimer: As a newcomer to web development, I have limited expertise in JavaScript. Situation: My current project involves creating an e ...

Avoid allowing users to accidentally double click on JavaScript buttons

I am working with two buttons in a Javascript carousel and need to prevent users from double-clicking on the buttons. Below is the code I am using: var onRightArrow = function(e) { if (unitCtr<=unitTotal) { unitCtr++; TweenLite.to(p ...

Move the div in an animated way from the bottom of the screen to the right

I am facing an issue with the image animation in my project. Currently, the image moves from the bottom to the left corner, but I want it to move from the bottom to the right corner instead. I have attempted using the transform translate property to achiev ...

Angular 8 is facing an issue where classes defined dynamically in the 'host' property of a directive are not being properly applied to the parent template

In my Angular 8 application, I am working on implementing sorting using the ng-bootstrap table. I referred to the example available at . In the sample, when I hover over the table header, it changes to a hand pointer with a highlighted class applied as sho ...

Resolving background div alignment issue in ASP.NET

I am facing a rather straightforward issue that requires resolution. I am currently working on fixing a background div (<div class="main-background">) that contains an image on my webpage. While it displays correctly in Design View in Visual Studio, ...

Tips on sending non-form values to an action in Struts 1.3 via AJAX

Here is a snippet of JSP code that I am working with: <%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%> <%@taglib uri="http://struts.apache.org/tags-bean" prefix="bean"%> < ...