简体   繁体   English

列元素(网格)中的li元素显示

[英]li element display inline in columns (grid)

I have <li> elements inside of an <ol> and would like to display it as shown below; 我在<ol><li>元素,并希望显示如下所示; can someone give me the css code to achieve this? 有人可以给我css代码来实现这个目标吗? I have generated these <li> elements with php so the HTML looks like this: 我用php生成了这些<li>元素,所以HTML看起来像这样:

<ol>
   <li>1</li>
   <li>2</li>
   <li>3</li>
   <li>4</li>
   <li>5</li>
   <li>6</li>
   <li>7</li>
   <li>8</li>
   <li>9</li>
   <li>10</li>
   <li>11</li>
   <li>12</li>
</ol>

and I would like to be displayed like this: 我希望像这样显示:

http://www.jqueryscript.net/demo/Accessible-Touch-Friendly-Drag-Drop-Html-List-with-jQuery/ http://www.jqueryscript.net/demo/Accessible-Touch-Friendly-Drag-Drop-Html-List-with-jQuery/

Above is an example, with jQuery, with that I am working channels editor and would like to get this like in image. 上面是一个例子,使用jQuery,我正在使用频道编辑器,并希望像图像一样。 I tried with display inline, width and height but no go, so I can't get it to work. 我尝试显示内联,宽度和高度,但没有去,所以我无法让它工作。

While not the best for older versions of IE, the only way I am aware of to achieve your desired results is by using the CSS3 column-count element. 虽然不是旧版IE的最佳选择,但我知道实现所需结果的唯一方法是使用CSS3 column-count元素。

CSS CSS

li{
    -webkit-column-count: 3;
    -moz-column-count: 3;
    column-count: 3;
}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM