YouTip LogoYouTip

Prop Style Backgroundcolor

```html\\n\\n \\n HTML DOM Style backgroundColor property\\n\\n \\n \\n\\n \\n

HTML DOM Style backgroundColor property

\\n

In this tutorial, you will learn how to use JavaScript's backgroundColor propertyto set the background color of HTML elements.

\\n\\n \\n
<div id="myDiv">This is an example div element.</div>\\n<script>\\n    var element = document.getElementById("myDiv");\\n    element.style.backgroundColor = "lightblue";\\n</script>
\\n\\n \\n \\n\\n```
← Prop Style BackgroundimageProp Style Backgroundattachmen β†’