What could be causing my background image to completely overlay the container?

Whenever I hover over an image on my website, a border appears from the top left corner and extends to the center of the image. However, once I added a background image to the section, it seems to cover up that effect. This design was working perfectly until I included the background image in the about class tag. I suspect there may be some interference happening with Bootstrap, which I am also using.

.about {
  background: linear-gradient(rgba(0, 0, 0, 0.4), rgba(0, 0, 0, 0.4)),
    url("img/sanfrancisco.jpg");
  background-position: center;
  background-size: cover;
  background-attachment: fixed;
  background-repeat: no-repeat;
  position: relative;
}

.about-img__container {
  position: relative;
}

.about-img__container::before {
  content: "";
  position: absolute;
  top: -24px;
  top: -1.5rem;
  left: -27.2px;
  left: -1.7rem;
  width: 100%;
  height: 100%;
  outline: 8px solid #0000ff;
  outline: 0.5rem solid #0000ff;
  z-index: -1;
  -webkit-transition: all 1s linear;
  transition: all 1s linear;
}

.about-img__container:hover:before {
  top: 0;
  left: 0;
}

.about-banner {
  color: #fff;
}

.about-banner-two {
  color: #0000ff;
}

<section class="about py-5" id="about">
<div class="container">
 <div class="row">
    <div class="col-10 mx-auto col-md-6 my-5">
    <h1 class="text-capitalize about-banner">
      About <strong class="about-banner-two">us</strong>
    </h1>
    <p class="my-4 text-muted w-75">Whenever I hover over an image on my website, a border appears from the top left corner and extends to the center of the image. However, once I added a background image to the section, it seems to cover up that effect. This design was working perfectly until I included the background image in the about class tag. I suspect there may be some interference happening with Bootstrap, which I am...
    </p>
  </div>
  <div class="col-10 mx-auto col-md-6 my-5 align-self-center">
   <div class="about-img__container">
    <img src="img/710-DC.jpg" class="img-fluid" alt="" />
   </div>
  </div>
 </div>
</div>;

<<div class="row ">
  
  <div class="col-md-12 text-center my-3 text-muted">
    <i class="fas fa-truck-moving"></i>
    <h6 class="text-uppercase my-3 mission-title">Our Mission</h6>
    <p class="w-75 mx-auto text-left mission-text">Whenev...
    </p>
  </div>
</div>

<div class="row">
  <div class="col-md-12 text-center my-3 text-muted">
    <i class="fas fa-binoculars"></i>
    <h6 class="text-uppercase my-3 mission-title">Our Vision</h6>
    <p class="w-75 mx-auto text-center mission-text">Whenever I hover over an image on my website, a border appears from the top left corner and extends to the center of the image. However, once I added a background image to the section, it seems to cover up that effect. This design was working perfectly until I included the background image in the about class tag. I suspect there may be some interference happening with Bootstra...
    </p>
  </div>
</div>

</div>

Answer №1

To resolve the issue, adjust the z-index of the .about-img__container::before pseudo-element by assigning a positive value such as 1 or greater. This simple tweak should do the trick! 😅

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

Ways to attach a MemoryStream to an image control without relying on a Handler

I am looking to fetch an image from the database and display it in a specific control. This is the code I currently have: MemoryStream stream = new MemoryStream(); byte[] data = (byte[])db.imagefile; stream.Write(data, 0, db.imagefile.Length); Is there ...

What is the best way to change CSS style for a button when clicked using JavaScript?

Is there a way to switch the background style of a CSS div when clicking the same button? function changeBg() { var divElem = document.getElementById("change-bg"); if (divElem.style.backgroundColor === "yellow") { divElem.style.backgroundColor ...

The Javascript Navbar is malfunctioning on Firefox

Currently, I am working on a horizontal menu that includes submenus. My goal is to use Javascript to display the submenu when a user hovers over the parent menu. I created a JSFiddle example, which seems to be experiencing issues in FireFox! However, it w ...

What is the method for inserting indicators between yAxis values in a yAxis ChartJs graph?

I have a line chart displaying the link below: https://i.sstatic.net/yUAHf.png There is a noticeable gap between 0-0.7 on the chart. I am looking to add an indicator similar to the one shown in this image: https://i.sstatic.net/pRjsY.png The desired ou ...

Is it possible to achieve a FadeIn effect without using the .hide()

Is there a way to achieve a fadeIn effect without interfering with margins when the object is hidden from the document? I would like it to animate from opacity 0, but I am struggling to make it work. Any suggestions or ideas would be greatly appreciated. ...

Issue with .css() function failing to apply width attribute

My goal is to shift the width of a div as specific images load in my application. I have tried reading the div's current width, adding 128 to it, and then using the .css() function to update the div's new width. However, I have encountered an iss ...

What are the common reasons for jQuery Image Slider malfunctioning?

After following a tutorial on Youtube (https://www.youtube.com/watch?v=KkzVFB3Ba_o) about creating a JQuery image gallery, I realized that my implementation is not working at all. Despite carefully reviewing my code and fixing any errors I could find, the ...

Disabling hover effects in Chart.js: A step-by-step guide

Is there a way to disable hover effects, hover options, and hover links on a chart using chart.js? Here is the code I have for setting up a pie chart: HTML.. <div id="canvas-holder" style="width:90%;"> <canvas id="chart-area" /> </div ...

Tips for making items move to the next line after floats

Here is the code snippet I'm working with: <div>First</div> <div class="second">Second</div> <a>Alink</a> div{ display: block; float:left; } .second{ clear:right; } http://jsfiddle.net/cg4gj/ I am ...

The Bootstrap Alert triggers the appearance of unnecessary whitespace

I'm in the process of setting up a basic support center using HTML. Everything was going smoothly until I incorporated a bootstrap alert. Placing the alert inside col-lg-4 as shown in the code snippet from bootsnipp caused an unwanted whitespace to ap ...

Concerns arise regarding the preprocessor directive for the ImgUrl attribute of the Image in ASP.NET

I'm looking to extract the ID value from a QueryString and append it to the ImgUrl path using the following code: <asp:Image ID="imgImageNormal" runat="server" ImageUrl='<%# string.Format("ImageHandler.ashx?ID={0}",Request.QueryString["ID" ...

Determining the class condition using AngularJS ng-class

I am working with an HTML element that contains AngularJS directives: <div class="progress"> <span ng-repeat="timeRangeObject in timeRangeObjects" style="width: {{timeRangeObject.percentage}}%" ...

Error message on Chrome for Android/iPhone: Issue with Whatsapp's Click-to-Chat link opening

Encountering an issue with the Whatsapp Click-to-chat feature on Chrome version 76.0.3809.132 for iOS and Android devices. The functionality was previously working, but now displays a Toast message on Android saying "Couldn't open link." Attempts to r ...

Sass effortlessly transforms the color black into its hexadecimal counterpart #000000

I am in the process of developing a mixin that simplifies the task of incorporating multiple fonts in a single line. Within the mixin, I specify the desired font weights as follows: $font-weights: ( "hairline": 100, "thin": 200, "light": 300, "regular": 4 ...

Modify the text tone within a specific cell

Welcome to my unique webpage where I have implemented a special feature. The text highlighted in red represents the unique identifier for each individual cell. Interestingly, below there is an input field containing the code "0099CC", which corresponds to ...

Looking to retrieve the <td> element using the class name?

When a specific condition is met in the class name, I want to apply styles to an entire row. The table structure I am working with is as follows: <table> <tbody> <tr> <td><div><span class='level2'></span&g ...

Fascinating CSS quandary: does the transparency of a parent element impact the transparency of a child element that is absolutely positioned, but not in relation

Check out this test case: https://jsbin.com/merujogudo/1/edit?html,css,output Should the element with .test class be transparent or not? Note: The current state is as follows: In Chrome and Firefox (latest versions): transparent In IE11: opaque It wou ...

Utilizing Bootstrap 5: Breaking a Page into Two Separate Vertical Sections

I am looking to design a unique grid system that divides the page into either 2 columns or 2 rows that are completely separate from each other. This means that the content on one side of the page does not expand to match the height of the content on the ot ...

Maintaining checked items in their original state while searching for another one in ion-searchbar can be achieved by properly handling

My goal is to maintain the checked items as checked when searching for another item in ion-searchbar. While I have managed to keep the checked items, the checkmark icon does not stay checked. What I aim for is to retain the checked state of all food items ...

Outcome of Request.Form when the input requested is empty

What can I do when Request.Form("myInput") is blank and causes a server error? Any suggestions on how to address this issue? Is there a method to verify if "myInput" has not been populated? ...