+ 2

Div or buttons: what do you prefer and why

I built a calculator using html,css and js. I went into the create section to get inspiration and how to go about it. I noticed that a lot of people used <div> for their form of inputs instead of buttons. Please why is that, is it a preference or a technical decision? ( I also noticed people using <div> in creating games as well). Your response is very much appreciated, Thank you!

27th Oct 2024, 12:57 PM
Afolabi Oluwatobi
Afolabi Oluwatobi - avatar
4 Answers
+ 2
You can use both the button and div tags since both are customizable. However, I’d prefer using button because that’s what it’s meant for, isn’t it? In game development, if you’re referring to custom elements, we often use div tags. Div tags serve as universal containers, ideal for custom elements like boxes or other objects. Tags like button and strong have specific purposes button for interactive buttons and strong for bold text so they’re generally not suitable for creating non-standard game elements.
27th Oct 2024, 3:02 PM
Luo Shenshi
Luo Shenshi - avatar
+ 2
Yeah in my opinion buttons are more suitable
28th Oct 2024, 9:09 PM
Afolabi Oluwatobi
Afolabi Oluwatobi - avatar
+ 2
Thank you Luo Shenshi
28th Oct 2024, 9:09 PM
Afolabi Oluwatobi
Afolabi Oluwatobi - avatar
+ 1
Afolabi Oluwatobi You're welcome đŸ€—
29th Oct 2024, 1:53 AM
Luo Shenshi
Luo Shenshi - avatar