Why does my navbar seem to turn transparent when I hover over the cards?

Throughout this question, I will be using the following Codepen as a reference: https://codepen.io/zarif-codes/pen/OJOBmLV

In my project for creating a product landing page (an FCC assignment), I've implemented a fixed navbar. Below is the HTML code for the navbar:

<header id="header">
<div id="center">
  <div id="brand-id">
    <img src="https://cdn-icons-png.flaticon.com/512/776/776588.png" alt="truck icon" id="header-img">
    <p>FastDel</p>
  </div>

  <nav id="nav-bar">
    <a href="#features" class="nav-link">Features</a>
    <a href="#pricing" class="nav-link">Pricing</a>
    <a href="#how-to" class="nav-link">How it works</a>
  </nav>
</div>

Here is the CSS styling for the navbar:

#header {
  box-shadow: 0px 3px 10px;
  background: rgb(0,9,36);
  background: linear-gradient(
    90deg, 
    rgba(0,9,36,1) 0%, 
    rgba(9,121,107,1) 62%, 
    rgba(0,91,255,1) 100%);
  position: fixed;
  top: 0;
  width: 100vw;
}

As you scroll down the webpage, you'll come across a 'Features' section which contains 3 cards with hover effects. Here's the CSS for these cards:

#features {
  display: flex;
  justify-content: space-around;
}

.feature {
  width: 28vw;
  border-radius: 1rem;
  box-shadow: 2.5px 5px 10px 0.1px;
  padding: 10px;
  display: grid;
  grid-template-columns: 1fr 2fr;
  font-size: 1.25vw;
}

.feature p{
  grid-column-start: 1;
  grid-column-end: 3;
}

.feature img {
  width: 6vw;
}

.feature:hover{
  animation-name: scale-big;
  animation-duration: 500ms;
  animation-fill-mode: forwards;
}

The issue I'm facing is that when scrolling down and the navbar overlaps the cards, hovering over the cards reveals the text through the navbar, making it appear transparent. How can I resolve this problem?

Answer №1

Dealing with a z-index issue can be quite frustrating. One potential solution is to increase the z-index value of #header in your CSS code. Check out the snippet below for a possible fix:

#header {
    z-index: 999;
}

Answer №2

Assigning a z-index to your Header can help ensure it remains in place.

 #header {
  z-index:10000;
 }

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

Having trouble displaying the background image in a Bootstrap jumbotron

I have tried everything I could find in my research, but I still can't get the background image to show up on the jumbotron. Currently, I am attempting to use an image from the images folder without success, and even trying a link doesn't work. I ...

Is there a way to create a CSS-based popup or tooltip without using any other coding languages

I've created code to enable scrolling for a paragraph within a popup. My goal is to hide all content outside of the popup <div> using only HTML and CSS. Is this possible? <div style="position:relative;"> <div id="popup" style=" ove ...

Tips for centering a div vertically inside another div that has a background image

My goal is to center the text within the background image, keeping it centered on all devices. Initially, I used a fixed pixel margin-top value, but I need it to be a percentage so that it remains centered as the screen size changes. However, when I change ...

What steps do I need to take in order to create a histogram with perfect symmetry?

I am looking to create a unique JavaScript program that can generate a symmetric histogram resembling the image provided below: This program will prompt the user to input the number of bars they want to display and specify the character used to draw the b ...

What is the method for modifying the parent reusable component's style from its child component?

I'm facing an issue with a reusable component in my current project. I need to modify the style of this reusable component, but I can't seem to figure out how to override the parent component's style within my child component. Parent reusab ...

What is the best way to organize angularjs controllers and directives within one another?

When I structure my controllers like this: <body ng-app="app" ng-controller="ctrl"> <div ng-controller="app-get"> <app-get></app-get> </div> <div ng-controller="app-post"> <app-post">& ...

Creating a semi-transparent div using CSS

My new project involves a background image with a div overlay. I'm hoping to make this overlay partially transparent so that the underlying background is still visible with some opacity. As someone who is just starting out with CSS, any guidance on ac ...

Transform a Javascript string variable into plain text within a pre-existing text document

Currently, I am storing user input from an HTML input as a JavaScript variable. The objective is to convert this data into plain text and save it in an existing text file. Essentially, each time the user provides input, it should be converted to plaintext ...

hyperlink to choose a specific option from a drop-down menu

The challenge I am currently working on involves page1.html <a href="/foo"></a> foo.html <select ng-model="ctrl.listvalues"> <option id="{{item.value}}" ng-repeat="item" in ctrl.availableValues" value="{{item.value}}">item.di ...

Adding EventListeners for Click Handling: A Step-by-Step Guide

Here is the part of my code in HTML: <!DOCTYPE html> <html> <head> <h> <title> This page</title> </h> </head> <body> <button id = "go-button" >GO ...

Tips for individually collapsing dynamic accordion panels within a Vue.js v-for loop

Is there a way to collapse accordions individually that are created inside a Vue.js v-for loop? I believe assigning a dynamic id to each accordion will help with this, but I am not sure where to add this id. Below is my HTML code: <div role="tablist"& ...

Selenium: verifying the presence of specific text within an element

Is it possible to use Selenium IDE to verify if the inner text of an element includes a particular string? As an example: <p id="fred">abcde</p> 'id=fred' contains "bcd" = true) ...

Pick Control - Utilize jQuery to display options that haven't been chosen before

Seeking assistance with a table view that includes a button for dynamically adding new rows. Each row contains a select control. Using Select2 for styling purposes. How can I ensure that when adding a new row, the select options only display those not prev ...

Enhancing an element with a modifier in CSS using BEM conventions without the need for @extend

Trying to grasp the best method for writing BEM modifier rules within parent classes. I've utilized SASS's @extend but question if this is the right approach. For example: If there is a class called .form structured like this: <div className= ...

Issues with Angular.js controller functionality

I am currently in the process of learning Angular and have been following the Intro to Angular videos provided on the official Angular website. However, I seem to be encountering an issue with my code that I can't quite figure out. The error message I ...

Having trouble getting my AngularJS animations to work, hitting a roadblock

Here is the code I've put together for you to review, with no official purpose in mind. I just saved this code to use at a later time. <script> var apps = angular.module('myApp', ['ngAnimate']); //header apps.cont ...

Is IntelliJ equipped with CSS autocomplete and Emmet features?

Encountering some challenges with IntelliJ 13 and autocompletion while working on CSS. Previously, to set margin: I would simply type: mar then press Tab. However, in the new version, it now shows max-resolution instead: Initially thought it might be rel ...

Cascading Style Sheets displaying inconsistently between local environment and server

Is it just me or does anyone else experience CSS behaving differently on a remote EC2 server compared to a local server? When I load the page and inspect it, I notice that different CSS rules are being applied. I've already executed collectstatic and ...

Bottom-aligned footer that remains in place instead of sticking to the page

I am attempting to position a footer at the bottom of the page, without it being sticky. Instead, I want it to remain at the bottom in case the user scrolls down there. Although it technically "works," there appears to be some white space below the footer ...

What is the best way to ensure that my Material UI container occupies the entire width and height of the

Struggling to fit my content within a Material UI container in a React project, but it's creating odd margins. Check out the current look: https://i.stack.imgur.com/TaQs2.png Here's how I want it to display with full width: https://i.stack.imgur ...