Home  >  Article  >  Web Front-end  >  LI vertical arrangement problem_html/css_WEB-ITnose

LI vertical arrangement problem_html/css_WEB-ITnose

WBOY
WBOYOriginal
2016-06-24 12:08:311649browse


  

        

  •     

  •     

  •     

  •     

  •   





如何让纵向排满一列自动换第二列,大虾们请执教。。。


回复讨论(解决方案)





Untitled Document





Arrange horizontally first and then move to the next line when the line is full.

It is recommended to use several DIVs. Fixed height, when the queue is full, it will be queued to the second one




< ;meta http-equiv="Conten...
It realizes that the horizontal row is filled first and then the next row is rowed.

This kind of arrangement will be incompatible in FIREFOX

< style>
.divclass{width:800px;height:50px;}
.divclass ul{margin:0;wdith:800px;height:50px;}
.divclass ul li{height:20px;wdith :50px; margin: 2px 0px; float: left}

This will make it horizontal

Add a floating alignment to li, you have to calculate it carefully The distance between li and li should be less than or equal to the length of ul. If you want to arrange them neatly, it is best to add an overflow hiding and height in li. It is definitely no problem. , but is it necessary, and doesn’t it feel weird to have 10 rows on the left and 1 on the right? Since you said that the right side is filled and then the right side is arranged, that is, the entire height is fixed, and the maximum number of rows on the left can be achieved (assuming 10). First, these li are positioned uniformly with position:absolute;, and then through jquery Position i for the first 10 navigations (i=0;i<10,I ){li[i].css({top:i*line height value;left:0px;})} and then position i for the 11 li (i=10;i<20,I ){li[i].css({top:i*line height value;left:100px;})}

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn