A
A
Alex Krynytskyi2021-01-17 20:32:28
React
Alex Krynytskyi, 2021-01-17 20:32:28

Why doesn't the :before style work in a React component?

import React from 'react';
import "./redtext.css";

const RedT = (props) => {

  let redTextStyle = {
    color:"red",
    postion:"relative",
    display:"block",
    "::before": {
      position: "absolute",
      content: "test",
      width: "100%",
      height: "20px",
      backgroundColor: "red",
      right: 0,
      bottom: 0,
      zIndex: -1,
    
    }
  }

  return (
    <span style={redTextStyle}
    
    >
      {props.children}
    </span>
  );
};

export default RedT;

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question