If you want them all in a line, you would have to know the width of each one. If you just want them to continuously loop like text normally does, there are a couple of different solutions.
Option 1
You can treat them like list items in a ul
and have this for your css:
.parent_div .child_div {
...
display: inline;
}
Option 2
You can float each div
to the left or the right, depending on which side you want them to come from:
.parent_div .child_div .from_right {
...
float: right;
}
.parent_div .child_div .from_left {
...
float: left;
}
Option 3
Like I was saying above, you need to know the width of each div
to be able to make them all appear in a single line on the screen. If you don't know how many elements there will be, you can consider making a table
(gasp!) to hold them instead of using divs
, like so:
<table class="data">
<tr>
<td></td>
<td></td>
<td></td>
</tr>
</table>
Just make sure everything is in the same tr
. Otherwise, the lines will wrap. The advantage of this is you can loop your creation script to make a certain, flexible number of elements appear in a row without even having to touch your css.