How to Change Button Size with JavaScript or CSS (3 Ways!)

Jon Middaugh
The Clever Dev
Published in
3 min readSep 27, 2022

--

I will show three examples of changing an HTML button’s size. Two of these use JavaScript and one is mostly CSS.

The buttons start with min-width: 240px and no set height.

Before we explore the technical how-to, I want to mention that it is usually good practice to set button min-width rather than width. This makes buttons mobile responsive and more web accessible.

However, if you have a use case where you want to change button size (width and height) using JavaScript, read on!

--

--

Jon Middaugh
The Clever Dev

I have been: individual contributor | tech lead | manager | JS boot camp teacher | community college instructor.