Responsive Table cell to new line

user1707077 picture user1707077 · May 18, 2013 · Viewed 71.3k times · Source

There's a third party content site that I have to "EMBED" via dynamic content, I don't know Ajax or Jquery at the moment so I am wondering if its possible to shift a table cell down to a new line essentially creating a new row.

The embed ends up with:

<table>
<tr>
<td></td>
<td></td>
</tr>
</table>

There were no classes or ID's placed in the table, however it is the only table on the page and it has way too much content to fit on one line, this is for a mobile website so I've got to make the whole page 320 pixels wide.

Is it possible using CSS alone?

I can't insert new HTML, the content is dynamically created from a secure server that we don't have access to, but we use an API key in order to access.. mediaqueries work though.

I'm currently trying to experiment with something along the lines of:

td {clear:both;}

Answer

user2019515 picture user2019515 · May 18, 2013

You can set the td to display:block; then they'll all be under eachother.

HTML

<table>
    <tr>
        <td>1</td>
        <td>2</td>
    </tr>
</table>

CSS

td{
    display:block;
}

See here: http://jsfiddle.net/hDsts/