Change Button Font Size with JavaScript or CSS: 2 Easy Ways!
Published in
3 min readSep 27, 2022
Sometimes it’s good to revisit HTML, CSS, and JavaScript and remember how to do the basics without the help of third-party libraries. In this tutorial I will update a button’s font size in two ways:
- Using JavaScript to update a button’s style.fontSize attribute
- Using CSS to update a button’s classList with a class that increases font size
The buttons in this example start out with 18px font applied using the button selector seen below in my CSS file: