Is it professional to style an anchor tag like a button?

Search something in the input field and you’ll see my links. I used a link around a div and styled them to look and act like a button. It doesn’t seem like it would be a professional standard. I am trying to learn ethical coding as I go along.


There is nothing unprofessional about what you have done with your styling. It is easy for users to realize that they can click on the button to get results.

Jennifer Bland

1 Like

I don’t see the need to wrap a div within an anchor. Why not just create an anchor only? Then your createDiv function could be simplified to:

function createDiv(title) {
  let link = document.createElement('a');
  let titleNoSpaces = encodeURI(title);
  link.setAttribute('href', `${titleNoSpaces}`);
  link.setAttribute('target', 'blank');
  link.setAttribute('class', 'item');
  link.innerText = title;

and you could get rid of the .item-link class definition in your CSS as long as you add text-decoration: none; to the .item definition.

Also, what is the purpose of divId in your createDiv? I did not see you making use of divID anywhere else in your solution, so my solution does not reference it.

1 Like

To be honest, I had know game plan with the div id. Your solution makes more sense for the time being. I guess I was thinking that I would was going to use the ids for something eventually. I do plan on coming back to this project and making changes when I learn more so we’ll see.

There is nothing unprofessional in displaying link as button. It depends on UI requirements. If it is UI requirement do it.