图像之间的HTML间距

时间:2014-03-20 03:15:41

标签: html

我有一个循环,如下所示,它显示了一些图像,彼此堆叠在一起 如何在这些图像的上方/下方添加垂直空间,以便它们不会碰到?

if (sizeof($connections))
{
    foreach($connections as $current_user_profile)
        echo "<li><img src='$current_user_profile.jpg' align='left' /></a>";
}

2 个答案:

答案 0 :(得分:1)

只需对图像应用边距即可。这个CSS会这样做:

img {
  margin-bottom: 50px;
}

答案 1 :(得分:0)

就像

一样
if (sizeof($connections))
{
    foreach($connections as $current_user_profile)
        echo "<li><img src='$current_user_profile.jpg' align='left' style='margin-top: 10px;' /></a>";
}