The navigation bar vanishes when a picture is inserted below it

I encountered an unusual issue on my webpage.

Everything was going smoothly with my navigation bar, even for mobile phones. However, as soon as I added a photo below the navigation bar, it disappeared...

I'd like to keep the navigation bar visible, but every attempt at fixing it seems to make it disappear altogether.

The picture needs to remain relative in order to maintain its correct display when resizing for mobile devices.

Does anyone have a solution to bring back the missing navigation bar?

Image CSS

   .header{
      max-width: 100%;
      margin-left: 0;
      margin-top: 0;
      position: relative;
      letter-spacing: 4px;
      margin-top: 70px;
      box-sizing: inherit;
    }
    .header-image{
      max-width: 100%;
      height: auto;  
      border-style: none;
      background-size: cover;
      background-position: center center;
      display: block;
      position: relative;
      box-sizing: inherit;
    }
    .header-image-text{
      position: absolute;
      top: 50%;
      left: 50%;
      transform: translate(-50%,-50%);
      box-sizing: inherit;
      display: block;
      text-align: center!important;
      margin-top: 16px!important;
    }
    .header-image-text h1{
      color: white;
      font-size: 38px!important;
      margin: 10% 0;
    }
    .header-image-text h1 .border{
      padding: 8px 16px!important;
      background-color: black;
      opacity: 0.75;
    }

Navigation Bar CSS

    .container{
        margin: 0 auto;
        width: 100%;
        position: fixed;
    }

    .nav{
      border-bottom: 1px solid #EAEAE8;
      text-align: right;
      height: 70px;
      line-height: 70px;
      position: fixed;
    }

    .menu{
      margin: 0 30px 0 0;
    }

    .menu a{
      clear: right;
      text-decoration: none;
      color: #000;
      margin: 0 10px;
      line-height: 70px;
      padding: 20px;
      border-radius: 40px;
    }

    .menu a:hover{
      background-color: #03999e3b;
    }
    label{
      margin: 0 40px 0 0;
      float: right;
      margin: 0 10px;
      line-height: 70px;
      font-size: 26px;
      display: none;
      width: 26px;
      float: right;
      
    }

    #toggle{
      display: none;
    }

    @media only screen and (max-width: 700px){
      label{
        display: block;
        cursor: pointer;
        position: fixed;
      }
      .menu{
        text-align: center;
        width: 100%;
        display: none;
      }
      .menu a{
        display: block;
        border-bottom: 1px solid #03989E;
        margin: 0;
      }
      #toggle:checked + .menu {
        display: block;
        position: fixed;
      }
    }

    .active{
      background-image: linear-gradient(315deg, #ffffff 0%, #03989E 74%);
      
    }

Answer №1

It seems like the image is overlapping the navigation bar. You can use the z-index property on the navigation bar to ensure it appears on top of the image. If you prefer not to have them overlap, you may need to make some adjustments to your layout CSS. Setting a higher z-index for the navigation bar, such as 10, will keep it in front of other elements with lower z-index values.

You can find more information about z-index here: https://developer.mozilla.org/en-US/docs/Web/CSS/z-index

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 hyperlink within the dropdown menu in HTML code is malfunctioning

I'm currently working on my personal website using HTML and CSS with textedit. I've successfully created functional links for the main navigation menu headings, but I'm encountering issues with the dropdown options. Whenever I try to click o ...

Modifying the position of an HTML element within its parent tag using document.createElement

As I dive into learning Javascript, I've come across document.createElement. This method allows me to create an HTML tag and insert it into an existing HTML parent element. However, I have a specific question in mind: Is it possible to choose the exac ...

Angular 4 allows the addition of an image from right to left upon clicking

I've been working on angular 4 and I've successfully implemented the functionality of adding flags. However, the issue is that the flags are currently appearing from left to right. What I'm aiming for is to have the images appear from right ...

Is it feasible to incorporate the CSS and Bootstrap (CDNs) specific to an HTML component without affecting the styling of other pages?

One way I am able to recycle the HTML component is using this code: $.get("nav.html", function(data) { $("#fulloptions").replaceWith(data) }) However, there’s a conflict because nav.html uses a different version of Bootstrap than my index file does ...

The impact of adjusting the article's margin-top on the margin-top of

I want these two divs to have different positioning. The sidebar should remain fixed at the top. Why is the sidebar aligned with the article div instead of sticking to the top? body{ margin: 0; padding: 0; } div#sidebar{ background-color: yel ...

Tips for concealing the final click (add) tab after it has been clicked and revealing the hidden (add) button when the user clicks on the remove button

I have created a form where users can add tests. Everything is working smoothly but I want the previous "Add Another Test" field to be removed when the user clicks on it and a new field to be shown. Everything is running well, but the issue is that when t ...

How can CSS be instructed to "apply the following most specific rule in order to determine this property"?

Utilizing Material-UI and JSS for CSS management, I've encountered an issue where styles appear differently in development versus production. The discrepancy stems from the order of rules within the file. For instance, when defining an element like ...

Tips for making text flow around an image

How can I achieve a design where the text wraps around an image positioned in the bottom right corner? [Image Removed by Owner] Your guidance on implementing this effect is greatly appreciated. Thank you. ...

Retrieve the image source when clicking on multiple posts that share the same div class and button class

<script src="https://code.jquery.com/jquery-1.11.1.js"></script> <script> $(function(){ $('.like').click(function(e){ e.preventDefault(); // stop the page from reloading alert( $('.post-container&apos ...

Creating a dynamic interaction between HTML forms and JavaScript using the onsubmit event handler

Having trouble getting my JavaScript file to fire when clicking the submit button on my simple HTML form. Can anyone provide some assistance? **UPDATED CODES Here is a snippet of my condensed HTML file: <html> <form name="form01" id="form01" ac ...

Switch up the current Slick Carousel display by utilizing a div element

We have implemented the slick carousel to show only one slide at a time within the <div class='item__wrapper'>. Beneath this are three items, and we want the slick carousel to update when any of these items are clicked. Issues Using item ...

Javascript - Conceal a Dynamic Div Depending on its Text

I have a unique table that generates dynamic Divs with ID's that count as they are created in the following format: <div id="dgpCheckDiv10_0"> <input Delete </div> <div id="dgpCheckDiv10_1"> text2 </div> Some of t ...

The div element is failing to adjust its height correctly to match its parent container

I'm struggling to make the red border that wraps around the text extend all the way to the bottom of its parent div. Setting the height to 100% isn't achieving the desired effect, as it needs to match the height of the image. Tip: Try resizing y ...

Issues with the functionality of Bootstrap

Upon loading the page, I am encountering an issue with a collapse on the 'main' id. It fails to collapse initially and only functions correctly after being clicked. I have not utilized 'collapse in', so I am unsure why this behavior per ...

How can we sort an array based on the inner HTML values of its children elements in JavaScript?

Can you arrange a JavaScript array based on the innerText values of its HTML elements? I am generating a div element (class="inbox" id="inbox${var}") with a number as its innerText, then adding all these divs to an array (numArr). I wan ...

Tips for locking the button in the navigation bar while scrolling

I noticed that when I have 6 fields in my navbar, with 5 of them being links and one as a dropdown, the scrolling of the page causes all fields to remain fixed except for the dropdown field.Check out this image description for reference https://i.stack.im ...

Creating visually appealing Jquery-ui tab designs

Trying to customize the jquery tabs, I experimented with styling them to my liking. One thing I did was attempt to reduce the size of the tabs by adding a height:45px; to the UI stylesheet shown below. .ui-tabs-vertical .ui-tabs-nav li { clear: left; ...

Make sure the navigation bar is fixed to the top of the page only

Looking for a solution to stick the navigation menu to the top of the screen only when the screen is wider than 782px. Progress so far: https://jsfiddle.net/ah4ta7xc/1/ Encountering an issue where there is an unintended gap at the top when applying the s ...

SVG is not extending to the entire viewport in mobile view

I need help with adjusting wave SVG's on my website to fill the entire viewport or screen width. Does anyone have any suggestions? To create the waves, I used a Wave SVG generator and placed them within a div element. <nav> <div> //align ...

When the React component's state is updated, an animation is triggered in a subcomponent connected to the parent component

The ProjectsSection component is responsible for rendering a document section with a header and cards. The goal is to trigger a header animation only when the header becomes visible on the screen for the first time and have it run once. However, adding a s ...