html - unable to put table next to each other -


i have read through other posts seems using display:inline-block , float:left doesn't fix problem. here's have:

.lefttable {    display: inline-block;    overflow: auto;    border: solid 1px black;    width: 20%;  }  .righttable {    display: inline-block;    overflow: auto;    border: solid 1px black;    width: 80%;  }
<table class="lefttable">    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="dairy">          <input type="image" src="<%=request.getcontextpath()%>/css/categories/dairy.jpg">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="meat">          <input type="image" src="<%=request.getcontextpath()%>/css/categories/meats.jpg">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="bakery">          <input type="image" src="<%=request.getcontextpath()%>/css/categories/bakery.jpg">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="fruitveg">          <input type="image" src="<%=request.getcontextpath()%>/css/categories/fruit &amp; veg.jpg">        </form>      </td>    </tr>  </table>    <table class="righttable">    <tr>      <th>img</th>      <th>product name</th>      <th>price</th>      <th>button</th>    </tr>    <tr>      <td></td>    </tr>  </table>

the result got

[lefttable] [img] [img] [img] [img] [righttable] [img] [product name] [price] [button] 

i want desired result of

[lefttable]               [righttable] [img]          [img] [product name] [price] [button]                                          [img] [img] [img] 

i can't seems spot mistake, have suggestion on how fix issue?

a simple approach might use display: inline-table on 2 tables, since want them behave inline elements.

floats work depends on other factors in layout.

.lefttable {    border: 1px dotted blue;    display: inline-table;    vertical-align: top;  }  .righttable {    border: 1px dotted blue;    display: inline-table;    vertical-align: top;  }
<table class="lefttable">    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="dairy">          <input type="image" src="http://placehold.it/101x50">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="meat">          <input type="image" src="http://placehold.it/102x50">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="bakery">          <input type="image" src="http://placehold.it/103x50">        </form>      </td>    </tr>    <tr>      <td>        <form action="testmartcontroller" method="post">          <input type="hidden" name="action" value="fruitveg">          <input type="image" src="http://placehold.it/104x50">        </form>      </td>    </tr>  </table>    <table class="righttable">    <tr>      <th>img</th>      <th>product name</th>      <th>price</th>      <th>button</th>    </tr>    <tr>      <td></td>    </tr>  </table>


Comments

Popular posts from this blog

google chrome - Developer tools - How to inspect the elements which are added momentarily (by JQuery)? -

angularjs - Showing an empty as first option in select tag -

php - Cloud9 cloud IDE and CakePHP -