Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

multiple tables on same line

Tags:

html

css

I have three tables that are all contained in a div. I am trying to get them to all show inline in the div, but they each show on their own line. I set them all to display: inline at the table level, but this didn't do the trick. Any ideas of how to get multiple tables to show on the same line?

 <div id="container">
   <table id="previous-arrow" class="scroll">
    <tr>
        <td><a href="#" id="nav-prev"><span>Previous</span></a></td>
    </tr>
   </table>
   <table id="tour-carousel">
    <tr id="carousel-row">
        <td>data here</td> 
    </tr>
   </table>
   <table id="next-arrow" class="scroll">
    <tr>
        <td><a href="#" id="nav-next"><span>Next</span></a></td>
    </tr>
   </table>
</div>
like image 939
Skitterm Avatar asked Nov 16 '12 21:11

Skitterm


People also ask

How do I add two tables together in a row?

You can merge (combine) rows from one table into another simply by pasting the data in the first empty cells below the target table. The table will increase in size to include the new rows.

How do you create a table with 3 columns and 3 rows in HTML?

Creating Tables in HTMLYou can create a table using the <table> element. Inside the <table> element, you can use the <tr> elements to create rows, and to create columns inside a row you can use the <td> elements. You can also define a cell as a header for a group of table cells using the <th> element.

How do you split a table in HTML?

Tables can be divided into three portions − a header, a body, and a foot. The head and foot are rather similar to headers and footers in a word-processed document that remain the same for every page, while the body is the main content holder of the table. <thead> − to create a separate table header.


2 Answers

You want to make them display inline, but still as tables (otherwise their content will create anonymous table blocks which cause wrapping).

display: inline-table;
like image 62
Quentin Avatar answered Dec 09 '22 06:12

Quentin


You can float them:

HTML

<div class="container">
    <table><tr><td>Table 1</td></tr></table>
    <table><tr><td>Table 2</td></tr></table>
    <table><tr><td>Table 3</td></tr></table>
</div>

CSS

table {
    float:left;
    width:33%;
}

Fiddle: http://jsfiddle.net/kboucher/6HuyW/

like image 29
Kevin Boucher Avatar answered Dec 09 '22 06:12

Kevin Boucher