Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <h2>HTML</h2> <p>The plain HTML way is to put it in a <code>&lt;form&gt;</code> wherein you specify the desired target URL in the <code>action</code> attribute.</p> <pre><code>&lt;form action="http://google.com"&gt; &lt;input type="submit" value="Go to Google" /&gt; &lt;/form&gt; </code></pre> <p>If necessary, set CSS <code>display: inline;</code> on the form to keep it in the flow with the surrounding text. Instead of <code>&lt;input type="submit"&gt;</code> in above example, you can also use <code>&lt;button type="submit"&gt;</code>. The only difference is that the <code>&lt;button&gt;</code> element allows children.</p> <p>You'd intuitively expect to be able to use <code>&lt;button href="http://google.com"&gt;</code> analogous with the <code>&lt;a&gt;</code> element, but unfortunately no, this attribute does not exist according to <a href="https://www.w3.org/TR/html5/forms.html#the-button-element" rel="noreferrer">HTML specification</a>.</p> <h2>CSS</h2> <p>If CSS is allowed, simply use an <code>&lt;a&gt;</code> which you style to look like a button using among others the <a href="https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-appearance" rel="noreferrer"><code>appearance</code></a> property (<a href="http://caniuse.com/#feat=css-appearance" rel="noreferrer">only Internet&nbsp;Explorer support is currently (July 2015) still poor</a>).</p> <pre><code>&lt;a href="http://google.com" class="button"&gt;Go to Google&lt;/a&gt; </code></pre> <pre><code>a.button { -webkit-appearance: button; -moz-appearance: button; appearance: button; text-decoration: none; color: initial; } </code></pre> <p>Or pick one of those many CSS libraries like <a href="http://getbootstrap.com/css/#buttons" rel="noreferrer">Bootstrap</a>.</p> <pre><code>&lt;a href="http://google.com" class="btn btn-default"&gt;Go to Google&lt;/a&gt; </code></pre> <h2>JavaScript</h2> <p>If JavaScript is allowed, set the <code>window.location.href</code>.</p> <pre><code>&lt;input type="button" onclick="location.href='http://google.com';" value="Go to Google" /&gt; </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload