-2

I'd like to add two tables in my web application:

<span><table><tr><td>A</td><td>B</td></tr></table></span>
<span><table><tr><td>C</td><td>B</td></tr></table></span>

I'd like that these two tables are positioning at the same row ie. horizontally,

How can I do this?

Jamie Taylor
  • 4,709
  • 5
  • 44
  • 66
Lamloumi Afif
  • 8,941
  • 26
  • 98
  • 191
  • 1
    Why are you placing a block level element (`table`) inside an inline element (`span`). Or even, why are you placing a table in a span? Just curious – Marijke Luttekes Sep 09 '13 at 10:50
  • did you have another version how to place two table horizontally? – Lamloumi Afif Sep 09 '13 at 10:59
  • Well, you could just use CSS to change the `display` type of the tables or use `float`, there's absolutely no use to place the tables inside a `span`. (More discussion on block elements inside inline elements here -> http://stackoverflow.com/questions/746531/is-it-wrong-to-change-a-block-element-to-inline-with-css-if-it-contains-another) – Marijke Luttekes Sep 09 '13 at 12:39

3 Answers3

3

Try this:

span{display: inline-table;}

or you could also do float: left; or display: inline-block;

and give width to your table.

see this demo

Bhojendra Rauniyar
  • 83,432
  • 35
  • 168
  • 231
1
span{
   display:inline-block;
}

here is jsfiddle link

Love Trivedi
  • 3,899
  • 3
  • 20
  • 26
1

For example:

<span class="table"><table><tr><td>A</td><td>B</td></tr></table></span>
<span class="table"><table><tr><td>C</td><td>B</td></tr></table></span>

And then the CSS:

.table{     
    float: left;
}
Joum
  • 3,189
  • 3
  • 33
  • 64