Place button side by side


Hello I wanted to have a back button and another to go to the analysis, when I go to see the site they always appear in one down and another up.

My code is:

 <a href="guardadorrebanhos.html">
      <p align="center"><input type="button" name="botao-voltar" value="Voltar">

 <a href="guardadorrebanhos.html">
      <p align="center"><input type="button" name="botao-analise" value="Análise">

And I do not like tossing side by side.

asked by anonymous 02.03.2015 / 10:29

3 answers


You have some problems with your current code:

Elements inside the link tag:

The <button/> element can not be within the <a/> element so it can be read in the documentation at: HTML5 Spec Document from W3C :


Content model: Transparent , but there must be no interactive content descendant.


The element may be wrapped around paragraphs, lists, tables, and so forth, even between sections, so long as there is no interactive content within (e.g. buttons or other links).

What translated:


Content template: transparent , but there should be no interactive content downlink.


The element can be wrapped around integer paragraphs, lists, tables, and so on, even entire sections, as long as there is no interactive content within it (eg buttons or other links). >

Close the tags

The <p/> elements are not closed, which is why your code does not generate HTML in the way you want it to.


You can put both links within a paragraph and format with CSS to get the look you want:

    padding:6px 4px;
    border:1px solid #ccc;
    font:15px arial, sans-serif;
    <a href="guardadorrebanhos.html">
    <a href="guardadorrebanhos.html">
02.03.2015 / 15:55

Do not apply a <input> tag inside a <a> tag and in this case it is only necessary by the buttons in a table:

<table border="1">
        <input type="button" name="botao-voltar" value="Voltar">
       <input type="button" name="botao-analise" value="Análise">
02.03.2015 / 14:24

Use the bootstrap

Just add your css and their classes to your components.

    <meta charset="utf-8">
    <title>JS Bin</title>
    <link rel="stylesheet" href="">
    <a class="btn btn-primary" href="guardadorrebanhos.html">Voltar</a>
    <a class="btn btn-primary" href="guardadorrebanhos.html">Análise</a>  

Live demo

02.03.2015 / 15:20