/    Sign up×
Community /Pin to ProfileBookmark

Loading Horizontally

Alright bare with me on this one.
I have a PHP script that loads in one picture after another into a plain HTML page. When the pictures load in they are presented vertically one right on top of the other along the left of the HTML page. Basically what i want to happen is when the pictures load in, have them load in Horizontally, side by side, until 100% of the page is used up , then start a new row and have the same thing happen until all the pictures are loaded in. How would i go about doing this?

to post a comment
HTML

4 Comments(s)

Copy linkTweet thisAlerts:
@MstrBobAug 30.2004 — simply place image tag after image tag. Since images are inline elements, they'll be placed next to each other until there's no room on the line.
Copy linkTweet thisAlerts:
@BassMasterFlashauthorAug 30.2004 — i actually have the pics sitting in a table..

[code=php]<table width="100" height="100" border="1" cellpadding="0" cellspacing="3" bgcolor="#A7B2BA">
<tr>
<td height="80" align="center">
<div align="center"><img src="trey/thumbs/img_2.jpg"></div></td>
</tr>
<tr>
<td align="center">buttons go here<td>
</tr>
</table>[/code]


how would i get tables to line up side by side?
Copy linkTweet thisAlerts:
@DocileWalnutAug 30.2004 — Make a two-dimensional loop.

First, figure out how many pictures wide you want the table to be. Please note that the number you choose will be referred to as "cols".

[code=php]
<table width="700">

<?
$cols=5;
$count=0;
for ($x=0; $x<($numimgs/$cols); $x++) {


echo "<tr>";

for ($y=0; $y<$cols; $y++) {
echo "<td><img src="image$count"></td>";
}

echo "</tr>";
$count++;
}
?>
</table>
[/code]


This will produce a table 750 pixels wide, 5 columns, and however many rows you need.

Beforehand, though, you'll need to count the number of images you'll be using and store them in $numimgs.

[I]Oh, and I forgot to mention. My example uses images named image1 image2 image3, etc.[/I]
Copy linkTweet thisAlerts:
@ray326Aug 30.2004 — Actually the easiest thing to do would be to replace all the table stuff with a single div then do what MstrBob suggested.
×

Success!

Help @BassMasterFlash spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.28,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...