I'm noticing that my HTML navigation bar is currently stuck to the left side of the margin. What steps should I take to fix this issue?

While working with Notepad++, everything functions properly. However, when using an ASP.NET web app in Visual Studio, the navigation bar displays oddly:

View Image of Nav

Even though the margin is set to 0, the nav bar protrudes out unexpectedly.

Is there a default setting in Visual Studio causing this issue?

Your insights are appreciated!

Here is the HTML and CSS code provided:

body {
    margin: 0 0 55px 0;
}

.nav {
    position: fixed;
    bottom: 0;
    width: 100%;
    height: 55px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
    display: flex;
    overflow-x: auto;
}

.nav__link {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    min-width: 50px;
    overflow: hidden;
    white-space: nowrap;
    font-family: sans-serif;
    font-size: 13px;
    color: #444444;
    text-decoration: none;
    -webkit-tap-highlight-color: transparent;
    transition: background-color 0.1s ease-in-out;
}

    .nav__link:hover {
        background-color: #eeeeee;
    }

.nav__link--active {
    color: #009578;
}

.nav__icon {
    font-size: 18px;
}
<html>
<head>
    <title>
        Bottom Nav Bar

    </title>
    <meta name="viewport" content="width=device=width, initial scale=1.0" />
    <meta charset="utf-8" />
    <link rel="shortcut icon" href="/assets/favicon.ico">
    <link href="/assets/favicon.ico" />
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
    <link rel="stylesheet" href="./css/nav.css">

</head>

<body>
 
    <nav class="nav">
    <a href="#" class="nav__link">
        <i class="material-icons nav__icon">dashboard</i>
        <span class="nav__text">Dashboard</span>
    </a>
    <a href="#" class="nav__link nav__link--active">
        <i class="material-icons nav__icon">person</i>
        <span class="nav__text">Profile</span>
    </a>
    <a href="#" class="nav__link">
        <i class="material-icons nav__icon">devices</i>
        <span class="nav__text">Devices</span>
    </a>
    <a href="#" class="nav__link">
        <i class="material-icons nav__icon">lock</i>
        <span class="nav__text">Privacy</span>
    </a>
    <a href="#" class="nav__link">
        <i class="material-icons nav__icon">settings</i>
        <span class="nav__text">Settings</span>
    </a>
</nav>

</body>


</html>

I have included the HTML despite facing difficulties doing so previously. Can anyone pinpoint why this functionality is not working as expected?

Answer №1

I have not given it a shot yet, but you could experiment with adding left: 0; to the CSS selector .nav, like this:

.nav {
    position: fixed;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 55px;
    box-shadow: 0 0 3px rgba(0, 0, 0, 0.2);
    background-color: #ffffff;
    display: flex;
    overflow-x: auto;
}

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

Change the text of a button by using an input field

How can I dynamically update button text based on input field value? <input class="paymentinput w-input" type="tel" placeholder="0" id="amount-field"> <button id="rzp-button1" class="paynowbutton w-button">Pay Now</button> I want the bu ...

Achieving a sleek line effect with a gradient border

Is there a way to make the gradient border transition between two colors look like a straight line? Additionally, is it possible to have the line start in the bottom left corner instead of the middle of the right side of the button? The current CSS code I ...

Tips for positioning a div to the left once the minimum width has been reached?

<div id="container"> <div id="subsSection"> <div class="leftSection">ss</div> <div class="rightSection">ss</div> </div> </div> (1) My goal is to have the subsection div centered on the ...

In JavaScript, it is necessary to determine if a checkbox is checked when modifying an input box

I have a table where each <td> contains an input box and a checkbox like this: <td> <input class="Comment" type="text" data-db="comment" data-id="{{uid}}"/> <input type="checkbox" id="summary" title="Check to set as Summary" / ...

The getElementBy method is failing to pass the value in the document

Here is the javascript code snippet I am using: document.getElementById('district').value = dist.long_name "this line is passing the value" document.getElementById('city').value = route.long_name "this doesn&apos ...

Attempting to implement a single toggle for numerous div elements

Concerning the answer provided in this query: How to slide down a div then .fadeIn() the content and vice versa? In the js fiddle shared, the jQuery code is specifically designed for one of the divs. If there are multiple divs, how can the jQuery code be ...

What causes the Sticky Nav menu to turn transparent and non-responsive?

I've implemented Sticky.js () to fix my page navigation once it reaches the top of the screen. Everything is working smoothly so far, except for a z-index or transparency issue that occurs when the stickiness is activated. The content seems to pass to ...

How can I specifically target and count children from a certain class using CSS selectors?

Consider this HTML structure with items arranged at the same level: <div class="h2">Title: Colors</div> <div class="pair">Hello world (1)</div> <div class="pair">Hello world (2)</div> <div class="pair">Hello wo ...

Creating a seamless and interactive online platform

I am in the process of designing a website that has a sleek and dynamic layout, rather than just a static homepage. Let me explain further: Here is my current setup so you can understand what I am trying to achieve. By dynamic, I mean that when the page ...

Place the small span element underneath the title span

I am currently working on a layout that includes a list item with the title "Item 0", followed by a small tag containing the text "Description Item 0", and two select menus positioned to the right. The challenge I am facing is placing the small tag below t ...

What is the reason for the input box remaining enabled even after selecting the checkbox?

Hello, I have a JavaScript function where I am attempting to disable an input box based on a checkbox checked in jQuery Mobile. However, it's not working as expected and the value is not being taken. How can I achieve this functionality? ...

Guide on Cordova: Playing MP4 videos in fullscreen and endless loop

I am looking to display a specific mp4 video file in fullscreen mode and on loop playback. Is there a plugin available that can help me achieve this? While researching, I came across the Videogular library designed for Angular-based applications. However ...

Can we add an opacity filter to the background image?

Is there a way to add opacity to just the background image on my website? I'm looking for a solution that applies the opacity solely to the image area. Check out my JSFiddle for reference. HTML: <header class="main-header " style="background-im ...

Avoid displaying a specific line of source code

Is there a way to conceal this specific HTML line so that it remains hidden from users when viewing the inspect element or viewing the page source? <input type="hidden" name="kda" value="<?php echo $code;?>"> Any suggestions on how I can achi ...

Setting the variable to global does not apply styling to the element

Looking for help with styling an element created using document.createElement("img")? let fireball; //global variable fireball = document.createElement("img") //variable on local fireballArray.push(someFunction(fireball, { src: "img.png&qu ...

Troubleshooting: eCharts Gauge Component not Displaying

Hey there, I'm currently working on implementing a gauge meter in my script. I found this code on echarts.com and now I'm trying to integrate it with asp. Although the console is not showing any errors, the gauge meter is not displaying properly? ...

What is the best way to split a single column into two using blocks?

I am working with a container that currently has all its blocks lined up in a column. I need to divide them into two columns, with 5 blocks in each. Unfortunately, the plugin I am using generates the code for me and does not allow me to insert my own div e ...

Behavior of floating footer in Wordpress across different web browsers is inconsistent

I'm facing an issue with the footer of my WordPress website, where it behaves differently in Chrome and Firefox. In Chrome, the right part of the footer seems to be moving out of alignment with the left part, while it displays correctly in Firefox. Y ...

Custom Trapezoid Design Using CSS3

Hello, I am trying to create a div that resembles the one in the image provided. I have been playing around with CSS3, but so far I've only managed to create a trapezoid shape with a different rotation. Is it possible to achieve this style using just ...

Colorful D3.js heatmap display

Hello, I am currently working on incorporating a color scale into my heat map using the d3.schemeRdYlBu color scheme. However, I am facing challenges in getting it to work properly as it only displays black at the moment. While I have also implemented a ...