我遇到了问题并没有解决。
What i want is that listing photos side to side
像那样:
The problem is that when i have 50 photos , this happens
我想要的是每列列出十张照片。我怎样才能做到这一点 ?
答案 0 :(得分:1)
当循环显示图像时,您需要打破每10张照片:
$photosPerLine = 10;
for ( var $i = 0; $i < $totalNumPhotos; $i++ )
{
drawPhoto(); // This does the actual drawing - perhaps echo a <IMG> or whatever
// Now we check if we've reached 10 in a row, we do this by dividing the
// photo counter by 10 and checking for a reminder, only numbers in leaps
// of 10 will divide without a reminder. If we don't have a reminder it means
// we're at 10, 20, 30 ... so we break the line
if ( ( $i + 1 ) % $photosPerLine == 0 )
{
echo( '<br/>' ); // Or create a new row in a table or whatever
}
}
或者只是将图像放在具有指定宽度的容器(例如<div>
)中,以准确保存10个图像,并让浏览器断开行以适应内容。