Having trouble with CSS Pseudo-element not functioning properly in React when implementing relative and absolute positioning techniques

.contact-icon{
    height: 10vw;
    width: 10vw;
    box-shadow: white 0 0 5px;
    position: relative;
    
    
}
.contact-icon:before{
    content: " ";
    top:0;
    position: absolute;
    height: 12vw;
    width: 12vw;
  
    background-color: red;
    filter: blur(50px);
    
    z-index: -2;
}

The pseudo element is not showing up when using absolute positioning. I also attempted without positioning, but it did not work either.

Answer №1

Would you mind removing the z-index: -2 CSS property, or changing it to z-index: 0? Alternatively, if you intend to use the z-index for something else, you can modify the background-color property of your body element to background-color: transparent

.container{
  background-color: transparent;
  height: 100vh;
  display:grid;
  place-content: center;
}

.call-icon{
  height: 10vw;
  width: 10vw;
  box-shadow: white 0 0 5px;
  position: relative;
}

.call-icon:before{
  content: " ";
  top:0;
  position: absolute;
  height: 12vw;
  width: 12vw;

  background-color: red;
  filter: blur(50px);
  z-index: -2;
}
<div class="container">
      <div class="call-icon"></div>
</div>

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

An uncomplicated vessel design

Having experience in mobile programming, I am accustomed to creating a parent hidden view and positioning subviews inside it. Now, I am trying to replicate the same functionality using HTML/CSS/Bootstrap. Let's say I have already laid out a cover bac ...

row-1 css classes on the top in a project built with Blazor

I'm currently working on customizing the standard layout provided in Blazor projects like WASM or server, but I'm a bit perplexed by the top-row px-4 css classes. Within the HTML code that appears to define the top row/header section is this sni ...

Exploring the world of CSS: accessing style attributes using JavaScript

So I created a basic HTML file with a div and linked it to a CSS file for styling: HTML : <html> <head> <title>Simple Movement</title> <meta charset="UTF-8"> <link rel="stylesheet" type=&qu ...

What is the best way to prevent a folder from being included in the next js build process while still allowing

I am faced with a challenge involving a collection of JSON files in a folder. I need to prevent this folder from being included in the build process as it would inflate the size of the build. However, I still require access to the data stored in these file ...

Issue with React Router causing blank page upon authentication verification

I'm new to React Router and I'm having trouble with implementing an authentication check when the app runs. I found a solution mentioned in this post: How to implement authenticated routes in React Router 4?. The idea is that if the user is logge ...

Error: Unable to access attribute 'item_name' as it is not defined

I'm new to React.js and I'm attempting to build a todo app. The main feature is a text input field where users can add items to their list. When I run "npm start," the app works perfectly and displays the expected output on my designated port. Ho ...

Exploring the creation of Request Headers

In my NextJS application, I have noticed that JavaScript resources are not being gzipped when accessed on mobile devices (while they work fine on desktop). After investigating further, I discovered that this is due to the lack of an Accept-Encoding header ...

What is the process for adding data to select box number two?

I am facing a challenge with loading data into two different select components in my React application. The first select successfully loads information from the API, but the second select component using react-windowed-select is not working as expected. Th ...

Creating an overlay button within various containing divs requires setting the position of the button

Tips for overlaying a button on each HTML element with the class WSEDIT. My approach involves using a JavaScript loop to identify elements with the CSS class WSEDIT, dynamically create a button within them, and prepend this button to each element. Below ...

Troubleshooting: Why isn't External CSS Functioning Properly in Broadleaf

I have encountered a question regarding the use of a custom email template in broadleaf. It seems that I am unable to apply an external CSS file and can only use inline styles. Is this normal behavior, or am I missing something? Below is how I am attempti ...

Developing an npm library with ReactJs: A step-by-step guide

As a newcomer to React, I am eager to create my own npm library in ReactJS. Taking inspiration from my existing React project, the goal is to transform it into a package (or library) that can be easily integrated into other projects. This means allowing ...

"Designing with CSS: The Art of Styling

Recently, I came across a styling issue with a text area. After adding the following code to the view file of a Yii Application and the corresponding styling code to the CSS file, I noticed that the border of the text area remained unchanged when an error ...

Margin not being applied to last element in parent - any ideas why?

Why does the margin of the last element, whether it is a <p> or <h1>, not have any impact? It should be pushing the background of the parent container downwards. .container { background: grey; } h1 { margin-bottom: 3em } p { margin- ...

The navigation bar is struggling to be positioned on top of the body

I have encountered an issue where I want my navbar to remain on top of all components, but when I open the navigation menu, it pushes all the components of the index page down. My tech stack includes Next.js, Tailwind CSS, and Framer Motion. This problem ...

The `react-router-dom` in React consistently displays the `NotFound` page, but strangely, the active class for the home page does not get

Currently, I am utilizing "react-router-dom": "^6.4.1" in my application and encountering two main issues: Upon navigating to another page, the home page retains the active class, resulting in both the new page and the home page disp ...

Adjusting the text color for select values within a <td> element

I have a table that is populated with data retrieved from an API. Each cell in the table contains multiple pieces of data. Below is the code used to create the table: <td class="myclass"> <?php $myvar = explode(" ", $json["data"]); ...

What is the best way to set the text color of cell data in a mat-table to white for the entire row when the row is selected as

Is there a way to change the text color when a row is selected in my application? I have already figured out how to change the background color of the row, but how can I target the text within the cells? I'm considering using a similar approach to th ...

Steps to Change the Default Value of Ant Design Date Picker upon Date or State Modification

AntD Version : 5.0 Upon loading the page, the default date is displayed, but I am passing a date stored in a state object. However, after successfully loading the page, changing the state of the date from one component does not update the default value of ...

Selecting the first li element using JQuery selectors

Can anyone help me with creating an onclick event that triggers when the user clicks on the first list item which is labeled as "Any Date"? I am looking to use jQuery to target this specific element. <ul id="ui-id-1" class="ui-menu ui-widget ui-widge ...

The background color in CSS remains stagnant, refusing to change despite

Can someone help me figure out why the background color isn't changing in my simple code? I've double-checked that the external CSS is properly linked because the text color of h1 is changing. <!DOCTYPE html> <html> < ...