Categories
JavaScript Answers

How to add inline style using JavaScript?

Spread the love

Sometimes, we want to add inline style using JavaScript.

In this article, we’ll look at how to add inline style using JavaScript.

How to add inline style using JavaScript?

To add inline style using JavaScript, we set the properties in the style object property.

For instance, we write

nFilter.style.width = "330px";
nFilter.style.float = "left";

to set the width and float CSS styles of the nFilter element.

Conclusion

To add inline style using JavaScript, we set the properties in the style object property.

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 *