Using the transform property causes mix-blend-mode to become ineffective

When I combine mix-blend-mode with the transform property, the mix-blend-mode functionality ceases to work. Is there a workaround for this issue? Although similar questions have been asked before like Does CSS mix-blend-mode work with transform?, they did not provide a solution.

You can find the Codepen example below (Please note that GSAP may not work in the snippet):

https://codepen.io/bimalpandeycode/pen/vYWZvao?editors=1111

let hasHovered = false;
const mouseEnterGSAP = () => {
  console.log("ENTER");
  hasHovered = true;
  gsap.to(".cursor", {
    width: 100,
    height: 100,
  });
}
const mouseLeveGSAP = () => {
  hasHovered = false;
  gsap.to(".cursor", {
    width: 0,
    height: 0,
  });
}
const cursor = document.getElementById("cursor");
document.addEventListener("mousemove", (e) => {
  cursor.setAttribute("style", `left:${e.pageX}px; top:${e.pageY}px; width:${hasHovered?"100px":"0px"} height:${hasHovered?"100px":"0px"}`);
});
body {
  background: black;
}

.cursor {
  background-color: white;
  position: absolute;
  top: 0;
  left: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  pointer-events: none;
  mix-blend-mode: difference;
  z-index: 2;
}

.skills__text__container__Main__langs {
  color: cyan;
}

.first {
  transform: skewX(20deg);
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/gsap/3.9.1/gsap.min.js"></script>
<script src="https://s3-us-west-2.amazonaws.com/s.cdpn.io/16327/CustomEase3.min.js"></script>
...
</script>

Answer №1

Update: By applying z-index to the div with mix-blend-mode, I was able to resolve the issue. I stumbled upon the solution on the SitePoint forum

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

Tips for adding a CSS marker to the Videogular timeline at a designated time

My HTML player application allows users to search for a term and then displays the results along with the time when those words appear. By clicking on a specific sentence, the HTML player will start playing from that location. However, I would like to enha ...

Combining Text and Images with a Background Video using CSS

I need help replicating a unique design I came across in a graphic design mockup. It involves a background video with a transparent green overlay, an image of a man fixed to the right side, and text flowing over it. I've managed to recreate most of it ...

Dealing with fluctuating content heights: strategies to handle varying content lengths

Over at this website, you will find an image carousel using Twitter Bootstrap which showcases various images along with captions. While all the images maintain the same height, the container for the caption adjusts its height based on the length of the tex ...

Creating unique borders with CSS styling

Encountering an issue with my CSS. I have a <table> where I added border using the following CSS: table, th, td, tr { border: thin 1px solid black; } The result is double solid lines as seen below. Looking for a way to create a table without s ...

Is there a way to reduce the height of the border-left property in CSS?

In creating a simple address panel, I have divided it into three sections: address, phone number, and email. Each section includes an icon and a paragraph next to it. To align these sections side by side, I used the vertical-align: top and display: table p ...

Switch out one picture for another by hovering over it

Looking for a way to replace the holder-01-small.png image with one of the same dimensions on hover without altering the HTML code. Here is the code snippet: <div class="mix category-1"> <a href="img/holder-01-large.png" class="photo"> <i ...

Tips for increasing a variable by one with each button click?

I have a simple JavaScript function called plusOne() that is designed to increment a variable by 1 each time a button is clicked, and then display the updated value on a webpage. However, I'm encountering an issue where the addition only occurs once. ...

Align an element to the center and then align a second element to the right using Tailwind CSS

Here is a visual representation of my goal: the dashed line indicates the center of the container. My objective is to horizontally center one div element and then right-align a second div within the same row, all while keeping both elements centered. htt ...

Elements that are hidden or not displayed are still able to receive mouse over events

I am in the process of learning how to handle events within svgs and I have encountered a strange issue. Currently, I am working on an infovis project where I create an interface to display various column-graphs. This part is functioning well so far. Ho ...

Tips for overlaying a webpage with several Angular components using an element for disabling user interactions

I currently have an asp.net core Angular SPA that is structured with a header menu and footer components always visible while the middle section serves as the main "page" - comprised of another angular component. What I am looking to achieve is ...

Tips for Creating an Upward-Dropping Dropdown Menu in HTML/JavaScript When Space is Limited on the Page

Hello, I am currently seeking a solution to adjust my dropdown menu so that it appears above instead of below when the page doesn't have enough space to display it fully. My tools for this project include HTML, Javascript, CSS, and JQuery exclusively. ...

Issue with iPhone CSS displaying differently on mobile devices

The CSS design does not display correctly on iPhone devices in real-life testing, even though it appears fine on browsers with mobile view emulators. Interestingly, the design also looks great on Android phones but encounters issues specifically on iPhones ...

What are some different CSS options for setting the indentation of the first line of

I've encountered an issue with how the <p> text-indent property appears when a page is printed using Internet Explorer's Active-X plugin. Here is the relevant CSS: p { font-family: Calibri; font-size: 20pt; line-height: 1.75em; margin-bot ...

JavaScript Cursor-Based Auto Typing Tool

I want to develop a straightforward Javascript auto writer within an HTML page. Below is the code I have written: <html> <head> <style> #type { display: inline-block; } #cur { display: inline-block; ...

The size of the website elements needs to be increased for better visibility on mobile devices

While developing the official website for my Discord bot - Idle Baker, I opted to utilize Bootstrap 5 for its user-friendly design features, making it easier than dealing with extensive CSS coding. After completing the homepage of the site, I encountered ...

Resolving the Blank Space Problem in DataTable CSS Styling

I encountered an unusual issue while working with DataTable in my project. Here's a link to view my DataTable example I have also attached a picture illustrating the problem I am facing. Is there a way to remove the blank space containing filter but ...

What determines the functioning of the "N-in-one" or "pill" button effect?

I am interested in incorporating a style element known as the "pill" button, which can be found by visiting the following link: http://jqueryui.com/themeroller/ (specifically the "Choice 1 | Choice 2 | Choice 3" widget) Refer to the screenshot below: To ...

Attempting to place numerous recurrent elements in a fixed position relative to the perspective of the observer

Describing the appearance of my button <a href="website" class="button">Link 1</a> Now, I need to place another set of 4 similar buttons in a horizontal row next to it. <a href="website" class="button">Link 2</a> <a href="webs ...

Determine the overall cost based on varying percentage increases for each step

I am currently working on developing a price estimation calculator. Here is the breakdown: For 1000 MTU, the price will be 0.035, resulting in a total of 35. For 2000 MTU, the price will be 0.034, making the total 67. For 3000 MTU, the price will be 0.03 ...

Comparison: CSS3 versus Angular Material CSS

My ul and li design in CSS is functioning perfectly on Bootstrap. However, when I apply the same code to an Angular Material project, the Angular Material CSS seems to be overriding my styles. CSS Code: li { width: 2em; height: 2em; text-alig ...