# Multiple styles setting in JavaScript

You can set several styles at once with one command. This is done using the `cssText` property:

`elem.style.cssText = ` width: 100px; height: 100px; display: block; `;`

This property is rarely used because such an assignment removes all existing styles: it does not add, but replaces them. You can accidentally delete something you need. But it can be used, for example, for new elements, when we know for sure that we will not remove the existing style.

Rewrite a code via learned property:

`elem.style.width = '100px'; elem.style.height = '100px'; elem.style.margin = '10px auto'; elem.style.color = 'red';`
←→
↑
en ru