DEV Community

Discussion on: Web Development Bad Habits to Kick

Collapse
 
chidioguejiofor profile image
Chidiebere Ogujeiofor • Edited

Nice article.

One question I have is that is a link styled to look like a button (the link has no onclick but just goes to a new different page) a bad habit ? If so I'd like to learn why

Collapse
 
lizlaffitte profile image
Liz Laffitte • Edited

I don’t think so! I often create a btn class that gives links the padding, background color and box-shadow to look like a physical button. It would be using a div with an a tag where you SHOULD use a button element.

I found this article really interesting, and it touches on how screenreaders interact differently with links and buttons: css-tricks.com/use-button-element/

Collapse
 
chidioguejiofor profile image
Chidiebere Ogujeiofor

Nice. thanks a lot. I wanted to be sure I wasn't doing the wrong thing all along

Also I learnt a ton from the article about buttons.

Thread Thread
 
lizlaffitte profile image
Liz Laffitte

Of course! I am growing and learning right there with you.

Collapse
 
aarone4 profile image
Aaron Reese

Because a button is expected to trigger an action within the context of the page. A link is a navigation tool. The confusion often comes from the action (e.g. form submit) also has the side effect of a navigation.