How to Change Font Size of Div in JavaScript? - Tutorial Kart

How to Change Font Size of Div in JavaScript?

JavaScript ? Change the Font Size of Div

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

Example

Change Font Size for Div in JavaScript

This is a paragraph in Div. This is a span in Div. Click Me function changeStyle(){ var element = document.getElementById("myDiv"); element.style.fontSize = "20px"; }

Conclusion

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

JavaScript

JavaScript Tutorial JavaScript Primitive Datatypes

JavaScript - If Else JavaScript - Switch JavaScript - Arrays JavaScript - forEach

JavaScript - HTML Element JavaScript - Access HTML Element by ID JavaScript - Change style of HTML Element JavaScript - Date JavaScript - Date Methods

JavaScript - Fixing Errors JavaScript SyntaxError: Invalid shorthand property initializer

................
................

In order to avoid copyright disputes, this page is only a partial summary.

Google Online Preview   Download