How can I place multiple html buttons that act as links on the same page?

Does any one know how I can place multiple html buttons that act as links on the same html page?

I am currently doing this:

<form action="http://justchillinc.wix.com/just-chill">       
    <input type="submit" value="Just Chill">
</form>
<form action="http://google.com">
    <input type="submit" value="Google">
</form>

没有风格的辉煌,但你明白了......任何带有一类按钮的标签都将被设计成相同的样式。

.button{
  display:inline-block;
  text-decoration:none;
  color:yellow;
  font-weight:bold;
  min-width:132px;
  min-height:37px;
  border:1px solid black;
  border-radius:12px;
  text-align:center;
  background-color:gray;
  box-shadow:8px 8px 8px gray;
  margin:10px;
  
  }
.button:active{
  background-color:green;
position:relative;
  top:8px;
  left:8px;

}
<a href="http://google.com" class="button" target="_blank">Link Here</a>
<a href="http://google.com" class="button" target="_blank">Link Here</a>
<a href="http://google.com" class="button" target="_blank">Link Here</a>
<a href="http://google.com" class="button" target="_blank">Link Here</a>

The way you do it is already good. Here are some other methods to do this:

  • With the a tag and some custom css (http://jsfiddle.net/pp4eufat/)

    HTML:

    <a class="button" href="http://justchillinc.wix.com/just-chill">Just chill</a>
    

    CSS:

    a.button {
        padding: 5px 10px;
        background-color: #ddd;
        color: #222;
        text-decoration: none;
    }
    

    You can easily assign the button class to submit buttons or similar to get a consistent button look all over your page.

  • With a button and javascript (http://jsfiddle.net/gdfx5fd3/)

    Code:

    <button onclick="window.location.href='http://google.com';">Google</button>
    

    The important part is onclick="location.href='http://google.com';" . It tells the browser to open http://google.com when the user clicks the button. The disadvantage is that the user has to have javascript enabled (nearly everybody has it enabled, so this isn't a big problem)


  • From:

    <form action="http://justchillinc.wix.com/just-chill">       
        <input type="submit" value="Just Chill">
    </form>
    <form action="http://google.com">
        <input type="submit" value="Google">
    </form>
    

    To:

    <form method="post" action="http://justchillinc.wix.com/just-chill">       
        <input type="submit" value="Just Chill">
    </form>
    <form method="post" action="http://google.com">
        <input type="submit" value="Google">
    </form>
    
    链接地址: http://www.djcxy.com/p/36598.html

    上一篇: 创建一个与Onlick的HTML按钮,作为一个链接?

    下一篇: 我怎样才能在同一页面上放置多个充当链接的html按钮?