gpt4 book ai didi

css - 在自上而下之前从左到右流动多列元素

转载 作者:行者123 更新时间:2023-11-28 10:19:40 26 4
gpt4 key购买 nike

这可能吗?

所以如果我们有一个列表:

  • 元素 1
  • 第 2 项
  • 第 3 项
  • 第 4 项

代替

元素 1 元素 3

元素 2 元素 4

我们想要

元素 1 元素 2

元素 3 元素 4

这是否可以通过多列布局模块实现,还是我最好使用老式 float 或内联 div 来实现?

最佳答案

像这样?

<style>
ul {list-style: none;}
li {float: left;}
li:nth-child(2n+1) {clear: left;} /* 1st of every twos */
</style>
<ul>
<li>item 1</li>
<li>item 2</li>
<li>item 3</li>
<li>item 4</li>
</ul>

关于css - 在自上而下之前从左到右流动多列元素,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12481337/

26 4 0
文章推荐: javascript - jquery - 在字段完成时通过单击按钮显示带有 if 语句的框 - 创建测验
文章推荐: javascript - 当我使用 ajax 时重复表单
文章推荐: javascript - ASP.NET:HtmlGenericControl
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com