[name]

[name] is a simplified version of [page:CSS3DRenderer]. The only transformation that is supported is translation.

The renderer is very useful if you want to combine HTML based labels with 3D objects. Here too, the respective DOM elements are wrapped into an instance of `CSS2DObject` and added to the scene graph.

Examples

[example:css2d_label]
[example:webgl_loader_pdb molecules]

Constructor

[name]( [param:Object parameters] )

[page:DOMElement element] - A [link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement] where the renderer appends its child-elements. This corresponds to the [page:CSS2DRenderer.domElement domElement] property below. If not passed in here, a new div element will be created.

Properties

[property:DOMElement domElement]

A [link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement HTMLElement] where the renderer appends its child-elements.
This is automatically created by the renderer in the constructor (if not provided already).

Methods

[method:Object getSize]()

Returns an object containing the width and height of the renderer.

[method:undefined render]( [param:Scene scene], [param:Camera camera] )

Renders a [page:Scene scene] using a [page:Camera camera].

[method:undefined setSize]([param:Number width], [param:Number height])

Resizes the renderer to (width, height).

Source

[link:https://github.com/mrdoob/three.js/blob/master/examples/jsm/renderers/CSS2DRenderer.js examples/jsm/renderers/CSS2DRenderer.js]