循环一个三行三列的结构

<style>
  *{
      padding: 0;margin: 0;
      list-style: none;
  }

  li{
      width: 90px;
      height: 190px;
      margin-right: 10px;
      float:left;
      background-color: chocolate;
  }
  div{
      width: 55px;
      height:55px;
      line-height:55px;;
      background-color: #f00;
      
      margin:0 auto;
      margin-bottom: 10px;
      text-align: center
  }

</style>


<ul id="ul"></ul>

<script>
    var str1=''
    var str2=''


    for(i=0;i<3;i++){
        str1+="<li>"
        for(j=0;j<3;j++){
            str1+='<div></div>'
        }
        str1+="</li>"
    }
    ul.innerHTML=str1

    </script>
全部评论

相关推荐

10-09 16:12
门头沟学院 Java
帅宇殿下:佬,简历写的什么
点赞 评论 收藏
分享
09-01 21:40
已编辑
同济大学 Java
点赞 评论 收藏
分享
评论
点赞
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务