2

I got stuck with particles in react. I would like to use particles as background of the component. However, many attempts were unsuccessful. I used position: relative for canvasClassName="Background" and position: absolute for className="Text". It does not work. Maybe someone could help.

    import React, { Component } from "react";
    import Particles from "react-particles-js";

    class Disinfection extends Component {
      render() {
        return (
          <React.Fragment>
            <div>
              <Particles
                canvasClassName="Background"
                params={{
                  particles: {
                    number: {
                      value: 600,
                      density: {
                        enable: true,
                        value_area: 1800,
                      },
                    },
                    color: {
                      value: "#ffffff",
                    },
                    shape: {
                      type: "images",
                      image: {
                        src: "../img/BANERIS COVID 19.png",
                        width: "50",
                        height: "50",
                      },
                     ...
                  
                  retina_detect: true,
                }}
              />
            </div>
            <h1 className="Text">The site is under construction</h1>
          </React.Fragment>
        );
      }
    }

    export default Disinfection;
R J
  • 41
  • 5

0 Answers0