Displaying an HTML/CSS image layered on top of another image with a fixed navigation bar

I've run into an issue with my webpage layout. I have a fixed navigation bar and an image displayed, but now I want to add another image on top of the existing one. However, when I use "position: relative" and position:absolute", the two images end up overlapping my navigation bar when I scroll.

Is there anyone out there who can provide some guidance on this matter?

If necessary, I can share the relevant code snippets.

(menueBar.css)
#menu-bar {
  font-family: Arial; 
  font-size: 20px; 
}

#name {
color: #ccc;
margin-left: 15px;
margin-top: 15px;
}

#nav{ background-color: #222;
      position: fixed; 
      width: 100%; 
      height: 133px;
      top: 0;
      left: 0; 
    }

... (omitted for brevity) ...

... more code snippets follow ...

Answer №1

It appears that there may be a potential z-index problem at hand here.

To address this issue, you can try setting the CSS property z-index:0 for the element that should be positioned below, and z-index:1 for the element that should be on top.

For more information and guidance on using the z-index property in CSS, you can refer to this resource.

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

Adding up nested arrays based on their respective indices

If I have two nested arrays within a corresponding array like this: const nums = [ [4, 23, 20, 23, 6, 8, 4, 0], // Each array consists of 8 items [7, 5, 2, 2, 0, 0, 0, 0] ]; How can I add the values based on their indexes? Expected Result: ...

Adding alpha or opacity to the background image will give it a unique and

Is there a way to darken the background image while keeping the text color the same? Check out this code snippet on JSFiddle div { display:block; background:url('http://placehold.it/500x500') 0 0 no-repeat; background-color:rgba(0 ...

Navigating through the labyrinth of SSH documentation

I'm looking to develop a lightweight SSH protocol client implementation for node.js. The documentation at is causing confusion. It lacks a comprehensive example of the key exchange process, making it difficult to understand how all the components fi ...

How can we determine if a 2D array contains a specific string using javascript?

I am currently working on a script to locate the horizontalWord string within a two-dimensional array. While my function for finding verticalWord strings is running smoothly, I am encountering some difficulties with the horizontalWord string. If you have ...

show a blob within an image element using JavaScript

I have a blob file retrieved from mySql and it looks like the image you see below. https://i.sstatic.net/DkLbh.png Now, I want to display this image using the <img src={imagefile}/> tag in React.js. How can I convert the blob file to a URL link? I ...

The modal dialog feature in HTML5 and CSS3 seems to be experiencing some issues when used in Opera browser

This informative post provides a detailed tutorial on creating a modal dialog using only HTML and CSS3. For more information, visit: To see a working demo, click here: The modal works flawlessly in most browsers, but some users have reported issues with ...

Exploring Webpack: Unveiling the Contrasts Between Production and Development CSS Bundles

Can you explain the differences in CSS between production and development when compiling with webpack? I've noticed that the production stylesheet seems to consider the entire website, whereas the development mode appears to only focus on the specifi ...

What is the best way to showcase an image before saving it in the database after it has been selected?

I am currently working on creating a feature where, upon selection of an image, a preview of the selected image is displayed before hitting the save button. Here's what I have in mind: <div class="row align-items-center my-5"> <div cl ...

Is there a way to keep a button in a "pressed" state after it has been clicked?

Could someone kindly share the code with me? I am looking for a button that remains pressed after clicking it. At times, I feel embarrassed for struggling with seemingly simple tasks. Grateful for any guidance or solution provided by this community! Man ...

What is the best way to show a message on a webpage after a user inputs a value into a textbox using

I have a JSFiddle with some code. There is a textbox in a table and I want to check if the user inserts 3000, then display a message saying "Yes, you are correct." Here is my jQuery code: $("#text10").keyup(function(){ $("#text10").blur(); ...

In react-native, when the string includes spaces, it will result in a line change

I am currently utilizing react-native in combination with styled-components. Whenever a string is typed into the text and followed by pressing the spacebar, it either results in too many line breaks or creates excessive empty spaces. An example of this i ...

AngularJS: When the expression is evaluated, it is showing up as the literal {{expression}} text instead of

Resolved: With the help of @Sajeetharan, it was pinpointed that the function GenerateRef was faulty and causing the issue. Although this is a common query, I have not had success in resolving my problem with displaying {{}} to show the outcome. I am atte ...

When you click on a list item, the page transitions to the details page. However, the details page will only display the

At the moment, the main list HTML is functioning correctly <div class="post row" ng-repeat="(postId, post) in posts"> <a href="{{ post.url }}">{{ post.title }}</a> However, when I select an item from the list and navigate to a new p ...

essential elements for mapping an array using typescript

Struggling to iterate through an array of objects, each with a unique id created by uuidv4(), resulting in a string type. TypeScript is giving errors (( Type 'String' is not assignable to type 'Key | null | undefined')) due to the &apos ...

When working with JavaScript, the `textarea` value property will not recognize line breaks or white spaces when being read

Recently, I've been developing a browser-based notebook app. However, I encountered an issue where if I type a note like this: *hello this is my first note The app displays it as: hello this is my first note Additionally, I want elements with the ...

Create an Excel spreadsheet by extracting data from a database through the use of Vue.js and Laravel Maatwebsite package

I have a query to fetch all records based on the specified date range of from and to. Using the maatwebsite package in Laravel version 2.x, however, I'm facing an issue where clicking the generate button does not result in generating an Excel file. I ...

The Boostrap card-deck appears to be see-through and malfunctioning

This problem has been puzzling me for quite some time now, and I just can't seem to find the solution! Kindly disregard the other language and code - the card is located under the jumbotron. (To access the link, remove spaces: https://code pen.io/ano ...

How to pass data from a child component to a parent component in React applications

In my search component, I need to pass a variable called "apiUrl" to the parent component. While I have successfully handled events for other parts of the code, I am unsure how to manage this specific variable transfer. The goal is to send the dynamically ...

Is it possible for me to pass a value through props that is not currently stored in the state?

Within the realm of Reactjs, imagine a scenario where there exists a <Parent> component containing state and a variable named foo, which is either 'global' or local to Parent. The question arises: Can we pass foo as props using <Child v ...

Share on your Twitter feed

Currently seeking assistance in implementing a function on my website that allows users to post their individual posts to Twitter. For example: Message: "hello world" [twitter] By clicking on the twitter button, the message will be posted along with the p ...