-3

I cant seem to get a Button element to link to one of my html files/pages. It can link to any other html page. This is an odd issue I cant seem to solve. The file it will not link to my file, writeReview.html but seems to work with other files. Fixed HTMl has been added.

    <button href="PlaceHolder">Write A Review</button>

<div class="buttonOne">
  <a href="./writeReview.html">Write A Review</a>
</div>

enter image description here

rioV8
  • 24,506
  • 3
  • 32
  • 49
Jake Lowe
  • 72
  • 7
  • Please share more details. What have you tried so far? Where are you stuck? What happens instead? – Nico Haase Apr 06 '21 at 14:58
  • 2
    Buttons doesn't support `href` – Alon Eitan Apr 06 '21 at 14:59
  • I can link any file using a HREF except one file. I have restarted my code editer and tested with other files – Jake Lowe Apr 06 '21 at 14:59
  • Buttons Dont support HREF? Then How would I link to the page then? – Jake Lowe Apr 06 '21 at 15:00
  • https://stackoverflow.com/questions/2906582/how-to-create-an-html-button-that-acts-like-a-link – Alon Eitan Apr 06 '21 at 15:00
  • Please explain further what you **want** to achieve, and what you've tried to achieve this. "I cant link this file" sounds pretty vague - what does that mean? – Nico Haase Apr 06 '21 at 15:02
  • 1
    buttons are not for linking pages. Linking other pages (resourcess) require an anchor. Buttons are for firing scripts like JS – tacoshy Apr 06 '21 at 15:03
  • create an `a` tag and style it with the same CSS as a button, use the Dev tools to see what the browser has defined for CSS button styling. Don't forget the `:hover` style. – rioV8 Apr 06 '21 at 16:41

1 Answers1

1

There is no href attribute for <button> elements.

If you want to link somewhere, use an <a> element.

<button> elements are (depending on their type attribute) either for dealing with <form>s or for having JavaScript hooked into. They are not links.

Quentin
  • 914,110
  • 126
  • 1,211
  • 1,335