Comment créer un bouton HTML qui agit comme un lien

Mots clés : htmlbuttonhyperlinkanchorhtml

meilleur 5 Réponses Comment créer un bouton HTML qui agit comme un lien

vote vote

96

<form action="https://google.com">     <input type="submit" value="Go to Google" /> </form> 
<a href="https://google.com" class="button">Go to Google</a> 
a.button {     -webkit-appearance: button;     -moz-appearance: button;     appearance: button;      text-decoration: none;     color: initial; } 
<a href="https://google.com" class="btn btn-primary">Go to Google</a> 
<input type="button" onclick="location.href='https://google.com';" value="Go to Google" /> 
vote vote

90

<button onclick="location.href='http://www.example.com'" type="button">           www.example.com</button>
vote vote

71

<a class="btn" href="">Link</a> <button class="btn" type="submit">Button</button> <input class="btn" type="button" value="Input"> <input class="btn" type="submit" value="Submit"> 
vote vote

67

<a href="http://www.stackoverflow.com/">     <button>Click me</button> </a> 
vote vote

58

<form>   <button formaction="http://stackoverflow.com">Go to Stack Overflow!</button> </form>

Questions similaires