Jump to content

Is it still common to do buttons with <button> in HTML?

Hip

Hey guys,

 

I wonder if there is any other way to create buttons because some stuff has changed over the years and I want to keep it up to date in code.

 

Thanks in advance!

Link to comment
Share on other sites

Link to post
Share on other sites

I use bootstrap for mine, much prettier and easily configured!

<button type="button" class="btn btn-primary"> etc etc, but yeah, its still the same in HTML 5! 

https://getbootstrap.com/docs/4.3/getting-started/introduction/

My Folding Stats Join the fight against COVID-19 with FOLDING! 

 

Aviation Engineer by day,

Game Developer by Night,

IT Engineer for a Hobby,

Husband in between!

 

Proud creator of EvoCore! 

https://play.google.com/store/apps/details?id=com.retrodex.evocore&hl=en

https://apps.apple.com/gb/app/evocore/id1459714064

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Hip said:

I actually do everything without libraries ?

I'm 100% the definition of amateur though! C# & Unity are my forte! In that case... yeah, I guess <button> away! ?

My Folding Stats Join the fight against COVID-19 with FOLDING! 

 

Aviation Engineer by day,

Game Developer by Night,

IT Engineer for a Hobby,

Husband in between!

 

Proud creator of EvoCore! 

https://play.google.com/store/apps/details?id=com.retrodex.evocore&hl=en

https://apps.apple.com/gb/app/evocore/id1459714064

Link to comment
Share on other sites

Link to post
Share on other sites

20 minutes ago, Retrodex Gaming said:

I'm 100% the definition of amateur though! C# & Unity are my forte! In that case... yeah, I guess <button> away! ?

I am learning HTML and CSS still so using libraries does not make sense for me.

Otherwise I won't be able to code myself.

Link to comment
Share on other sites

Link to post
Share on other sites

im not 100% sure because im more of an backend guy

but i think it doesnt matter if you use <button> or some other tag because the styling is done by class name in frameworks like bootstrap later

 

if you dont use bootstrap, you will style your buttons yourself anyways and you dont really have to use the button tag in that case

but imo its cleaner to use button

 

what im trying to say you can make <div> the same look / feel & same actions as a <button> if you use javascript & css

but i like to use the button tag because the code is a bit cleaner that way 

Link to comment
Share on other sites

Link to post
Share on other sites

HTML5 is even more semantic than HTML 4.01: Navigation areas are <nav> now, article areas are <article> - so everything's fine. :) 

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

You can use anything as a button, just style it after and put an onclick on it. Most common uses are still the <button> and quite often the <a>.

I have no signature

Link to comment
Share on other sites

Link to post
Share on other sites

A button does not submit afaik. The only submit i ever have to prevent is from a form. Which you can easily prevent by adding "onsubmit="return false;"" to the tag.

I have no signature

Link to comment
Share on other sites

Link to post
Share on other sites

An "input type=submit" is technically a specialized button.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

I might be wrong, but as far as I know, tags like <button>, <article>, <nav>, etc. are not mandatory, but it is recommended that you do use them, as it helps different software understand the page better and display it in a specific way for people with disabilities.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×