Difficulties arise when dealing with card elements and scrolling on a

Currently working on an ecommerce simulation project for a course, I successfully implemented a featured section with cards. However, when it comes to scrolling, I am facing an issue where the cards overlap with my sticky navbar as I scroll down. If anyone can help me identify a solution or point out what might be causing this problem, I would greatly appreciate it. Below is the code I have been working with.

<html lang="en">
<head>
 <meta charset="UTF-8">
 <meta http-equiv="X-UA-Compatible" content="IE=edge">
 <meta name="viewport" content="width=device-width, initial-scale=1.0">
 <title>Libros leidos</title>
 <script src="https://kit.fontawesome.com/87b9d53f02.js"></script>
<link href="https://cdn.jsdelivr.net/npm/<a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="0e6c61617a7d7a7c6f7e4e3b203c203c">[email protected]</a>/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-Zenh87qX5JnK2Jl0vWa8Ck2rdkQ2Bzep5IDxbcnCeuOxjzrPF/et3URy9Bv1WTRi" crossorigin="anonymous">
<link rel="stylesheet" href="style.css">
</head>

<body>
<!--navbar-->
 <nav class="navbar navbar-expand-lg py-3">
  <div class="container">
    <img src="img/logo.png" class="logo">

    <button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navmenu">
      <span class="navbar-toggler-icon"></span>
    </button>

    <div class="collapse navbar-collapse">
      <ul id="navbar"  class="navbar-nav ms-auto" >
        <li class="nav-item"><a href="index.html" class="nav-link">Home</a></li>
        <li class="nav-item"><a href="#shop" class="nav-link">Tienda</a></li>
        <li class="nav-item"><a href="#rentals" class="nav-link">Alquiler</a></li>
      </ul>
    </div>
  </div>
 </nav>

 <!--header-->
<section class="header p-5 text-center text-sm-start">
  <div class="container">
   <div class="d-sm-flex align-items-center justify-content-between ">
    <div>
      <h4 class="py-2">Looking for new stories to read?</h4>
      <h2>Read a well-loved book</h2>
      <h6 class="py-4">Find it in our collection of second-hand books</h6>
      <button class="explr btn-lg text-center">Explore</button>
    </div>
    <img class="img-fluid d-none d-sm-block" src="img/bookrow.png" alt="">
   </div>
  </div>
</section>

<!--featured-->

<section class="feature p-5">
  <h2 class="text-center">This Week's Recommendations</h2>
  <h4 class="text-center py-3">Our recommendations this week focus on Latin American authors</h4>
  <div class="row text-center g-4">
    <div class="col-sm">
      <div class="card" style="width: 18rem;">
        <img src="img/books/linro1.webp" alt="book cover image" class="card-img-top">
        <div class="card-body">
          <h3 class="card-title">Pedro Paramo - Juan Rulfo</h3>
        </div>
      </div>
    </div>
    <div class="col-sm">
      <div class="card" style="width: 18rem;">
        <img src="img/books/libro3.webp" alt="book cover image" class="card-img-top">
        <div class="card-body">
          <h3 class="card-title">La Fiesta Del Chivo - Mario Vargas Llosa</h3>
        </div>
      </div>
    </div>
    <div class="col-sm">
      <div class="card" style="width: 18rem;">
        <img src="img/books/libro4.webp" alt="book cover image" class="card-img-top">
        <div class="card-body">
          <h3 class="card-title">Rayuela - Julio Cortázar</h3>
        </div>
      </div>
    </div>
    <div class="col-sm">
      <div class="card" style="width: 18rem;">
        <img src="img/books/libro5.webp" alt="book cover image" class="card-img-top">
        <div class="card-body">
          <h3 class="card-title">María - Jorge Isaacs</h3>
        </div>
      </div>
    </div>
  </div>
</section>

Answer №1

It seems like your issue may involve the z-index in the CSS code. The z-index property determines the stacking order of elements on a web page, with higher values covering lower ones.

To learn more about z-index, you can visit this link - 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

Automatically insert content into a div following the execution of an AJAX delete function using jQuery

I've been working on a feature to display an auto-populated message in the results div when a user deletes the last item from their favorites list, indicating that it is empty. However, I've hit a roadblock and can't seem to make it work. H ...

How about a CSS one-by-one black pixel that's not opaque?

I've been attempting to achieve a 70% transparent black background on an element, but unfortunately, I had to use a pixel to address browser compatibility problems. Using CSS alone would make the entire content of the element transparent as well. Her ...

The search bar is visible on desktop screens and can be expanded on mobile devices

Check out my code snippet below. <style> #searchformfix { width: 50%; border-right: 1px solid #E5E5E5; border-left: 1px solid #E5E5E5; position: relative; background: #fff; height: 40px; display: inline-block; border: ...

Modifying the boolean variable value in aspx.vb code

Recently, I started learning asp.net and I am facing an issue with changing the value of my boolean variable when I click a button. Below is my code: Partial Class Title Dim checker As Boolean Protected Sub Enterbutton1(ByVal sender As Object, ByVal e ...

When using ContentEditable in Firefox, it generates double line breaks instead of a single one

Noticed an interesting issue with div contenteditable where Firefox is interpreting 1 newline as 2 newlines. Is this a bug or am I overlooking something? Test it out in the example below by typing: Hello World within the contenteditable. When accessi ...

To create a distinctive design, the HTML5 wrapper will specifically enclose the Header element

After using a border, I discovered that my wrapper is only wrapping the header and not extending down to the footer. Can anyone offer some guidance on how to wrap the entire content from the header to the footer? I've come across suggestions to speci ...

Exploring the ins and outs of webpage loading speed

I am working on writing JavaScript code that includes a button to open a webpage of my choice. I now want to understand how to detect when the page I called is finished loading. Any suggestions or ideas on this topic? I apologize if my explanation was no ...

Troubleshooting: Unsuccessful Data Binding in HTML5 Input Date using Angular

Having trouble binding a date to an input field: <body ng-app> <div ng-controller="MainCtrl"> <input type="date" ng-model="dateString"/> <br/>{{ dateString }} <br/><input type="date" ng-model="date1"/ ...

Unexpected border-bottom styling issue observed on adjacent div elements

This is my unique code: <!DOCTYPE html> <html> <head> <style> </style> </head> <body> <div style="border-bottom:1px solid black"> <div style="width=50%;float:left">A new paragraph with u ...

What is the best method for inserting dynamic HTML content (DIV) with JavaScript?

Can someone assist me in dynamically adding HTML content when data is returned from the server-side? I am currently using ajax/jQuery to handle server-side processing requirements. The success code section of my ajax function allows me to write HTML elemen ...

Sass Alert: The mixin called roboto-family is missing from the stylesheet. Trace: Problem detected in src/pages/forms/forms.scss at

Greetings, I am diving into the world of Ionic for the first time. Recently, I embarked on a new project in Ionic and decided to integrate a theme. To do so, I copied an .html file, an .scss file, and also created a .ts file. Forms.html <!DOCTYPE html ...

Bulma: Tips for creating equally sized buttons?

I am working with Bulma CSS and trying to ensure that all my buttons are the same size. Currently, each button appears to have a different size based on the text content. I have looked into using the "is-fullwidth" option, but it makes the buttons too la ...

Designing a flawless CSS pattern for the online world

Currently, I am working on creating a seamless CSS pattern for the web. Even though this may seem impractical and nonsensical, I find joy in experimenting with it. View my progress here After successfully designing my first tile, my next challenge is to ...

Center an image vertically and horizontally within a div element inside a container, even if the image sizes and aspect ratio differ, while also including padding

I am looking to vertically align images with varying ratios, where the image may be larger or smaller than the content and also include padding; I have tried different solutions found here, but none seem to cover all my requirements; I specifically need i ...

Overlay with a progress bar that obscures visibility

I'm dealing with a progress bar that needs to be displayed on top of an overlay. If you take a look at this jsfiddle, you can see the issue. Here's the markup: <div class="overlay mouse-events-off"> <div class="progress progress-st ...

"Enhance your listening experience with an audio player featuring album covers as captivating

Is there a way to create an audio player with the album cover image serving as the background, while ensuring all control buttons are displayed on top of that same image? I attempted using the following code snippet: <audio controls = 'controls&ap ...

Opera fails to recognize background hover transitions on links

One of my web design projects includes a transition that creates a rounded background that fades in when links are hovered over. Unfortunately, the transition doesn't seem to work properly in Opera, even though it functions well in Firefox, Chrome, an ...

Tips for preventing CORS errors while rendering an image on a canvas

Working on a project for my coding bootcamp where I need to overlay bandaids on an image of a bear using canvas. The main challenge is to check the color of the area that users click to ensure they don't put bandaids on the white space around the actu ...

ajax and codeigniter combination for selecting options

Is it possible to implement a set_select option within an AJAX component for a dynamic dependent dropdown list that is being cleared after validation errors? I am looking to incorporate the set_select functionality in the code snippet below: <script ty ...