循环重叠图像

时间:2012-09-01 04:48:42

标签: javascript image css-float alignment

我是JavaScript的新手。我有一个函数应该循环相同的图像和文本26次。并将它们显示为图像和文本的多个段落。然而,我的循环与文本和图像重叠,如下所示。 format I do not want

我希望我的代码能够显示如下图所示的图像。format I want to display.

我该如何解决这个问题?我的JavaScript代码看起来像这样

function getData() {
  var stringData = '';

  for (i = 0; i < 26; i++) {
    stringData = stringData + '<div><image src="img/sample-image.png" width="10% "height="10%" align="left" border="0"/>' + 'In this example a sample of the album photo on the site shall appear alongside a simple description of the album. To view the album select the album.</div><br/>';
  }

  document.getElementById("list-menu").innerHTML = '' + stringData + '';
}

1 个答案:

答案 0 :(得分:2)

只需添加two <br />s should do the trick.,除此之外,请尝试clear: both in your div CSS