欧美一区二区三区,国内熟女精品熟女A片视频小说,日本av网,小鲜肉男男GAY做受XXX网站

左浮動不適用于一系列div

錢諍諍2年前10瀏覽0評論

我有以下Javascript代碼:

{
var x = document.createElement('div'); 
x.setAttribute('class','rowone');
x.setAttribute('id',i);
var move = 4;
x.style.marginLeft = move + "%";
x.addEventListener('click',clickdata,'false');
     } // creating each div block
{ 

  var p = document.createElement('IMG');
  p.style.width = "80%";
  p.style.height="100%";
   p.src = orderone[i];
x.appendChild(p);
   } // creating the text in block, mostly for test
document.body.append(x); // appending x into the document
} // creating first row and adding event listener
for(var j = 0; j < 8; j++){
{
var x = document.createElement('div'); x.setAttribute('class','rowtwo');
x.setAttribute('id',j+8);
var moverow = 4;
x.style.marginLeft = moverow + "%";
x.addEventListener('click',secondclick, 'false');
} // creating each div block
{ 
/*var p = document.createElement('p');
p.innerHTML = ordertwo[j];*/
  var otherp = document.createElement('IMG');
  otherp.style.width = "80%";
  otherp.style.height="100%";
   otherp.src = ordertwo[j];
x.appendChild(otherp);
  } // creating the text in block, mostly for test
document.body.append(x); // appending x into the document
 }

(orderone和ordertwo只是圖像數(shù)組) 它所做的是創(chuàng)建兩行div,所有div都有一個圖像(來自orderone或ordertwo)。它應(yīng)該是這樣的:Ideal case

然而,這些行經(jīng)常只是隨機地分開(有時它工作正常,有時它只是給出一些其他的分類,如下所示):not Ideal case

我該怎么辦?

將所有div容器設(shè)置為相同的高度,溢出設(shè)置為隱藏,如下所示:

.myDivs { 
    height: 200px;
    overflow: hidden;
}

更改高度以匹配您的大部分圖像或最高圖像的高度。任何高于你身高的東西都將被隱藏