JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://unpkg.com/three@0.109.0/build/three.min.js"></script>
<script src="https://unpkg.com/three@0.109.0/examples/js/renderers/CSS3DRenderer.js"></script>

JavaScript

const width  = window.innerWidth;
const height = window.innerHeight;

const scene  = new THREE.Scene();
const camera = new THREE.PerspectiveCamera( 60, width / height, 0.01, 1000 );
camera.position.set( 50, 0, 100 );
camera.lookAt( 0, 0, 0 );
const renderer = new THREE.CSS3DRenderer();
renderer.setSize( width, height );
document.body.appendChild( renderer.domElement );

const element = document.createElement( 'div' );
element.style.width = '100px';
element.style.height = '100px';
element.style.background = 'blue';
const object = new THREE.CSS3DObject( element );
scene.add( object );

const childElement = document.createElement( 'div' );
childElement.style.width = '50px';
childElement.style.height = '50px';
childElement.style.background = 'red';
const childObject = new THREE.CSS3DObject( childElement );
object.add( childObject );

( function anim () {

	requestAnimationFrame( anim );
	renderer.render( scene, camera );

} )();

// hide after 1 seconds

setTimeout( () => {

	object.visible = false;

}, 1000 );