Categories
JavaScript Answers

How to set style on body with JavaScript?

Spread the love

Sometimes, we want to set style on body with JavaScript.

In this article, we’ll look at how to set style on body with JavaScript.

How to set style on body with JavaScript?

To set style on body with JavaScript, we set the style properties.

For instance, we write

document.body.style.display = "block";

to set the display property style to 'block' on the body.

document.body is the body element.

Conclusion

To set style on body with JavaScript, we set the style properties.

By John Au-Yeung

Web developer specializing in React, Vue, and front end development.

Leave a Reply

Your email address will not be published. Required fields are marked *