0

我是 JavaScript 的新手。我有一个函数应该循环相同的图像和文本 26 次。并像多段图像和文本一样显示它们。然而,我的循环与文本和图像重叠,如下所示。我不想要的格式

我希望我的代码显示如下所示的图像。我要显示的格式。

我怎样才能解决这个问题?我的 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 + '';
}
4

1 回答 1

2

只需添加两个<br />s 就可以了。,除此之外,请尝试clear: both在您的 div CSS中。

于 2012-09-01T04:54:52.397 回答