JavaScript – Change the Padding of Div

To change the padding of a div using JavaScript, get reference to the div element, and assign required value to the element.style.padding property.

Example

Conclusion

In this JavaScript Tutorial, we learned how to change the padding of a div using JavaScript.