html – 如何在垂直排序列表?

html – 如何在垂直排序列表?,第1张

概述我在下面使用 HTML和CSS代码对垂直排序列表,输出是水平排序的. 我的示例代码: <!DOCTYPE HTML><html> <head> <title>Tiles</title> <style type="text/css"> #tiles { list-style: none; margin: 0px; } #t 我在下面使用 HTML和CSS代码对垂直排序列表,输出是水平排序的.

我的示例代码:

<!DOCTYPE HTML><HTML>  <head>    <Title>Tiles</Title>    <style type="text/CSS">    #tiles {        List-style: none;        margin: 0px;    }    #tiles li {        float: left;        margin: 20px;        wIDth: 300px;        height: 200px;        background-color: #dddddd;        Font-size: 72px;        text-align: center;        vertical-align: mIDdle;    }    </style>  </head>  <body>    <ul ID="tiles">       <li>1</li><li>2</li><li>3</li><li>4</li><li>5</li><li>6</li>    </ul>  </body></HTML>

输出是:

但是,我想要这个输出.

请给我垂直排序列表的代码.

解决方法 使用 CSS columns:( JSFiddle)

ul {    column-wIDth: 380px;    -webkit-column-wIDth:380px;    -moz-column-wIDth: 380px;    height:440px;}#tiles {    List-style: none;    margin: 0px;}#tiles li {    /* float: left; */    margin: 20px;    wIDth: 300px;    height: 200px;    background-color: #dddddd;    Font-size: 72px;    text-align: center;    vertical-align: mIDdle;}

请注意,这在IE≤9中不起作用.

总结

以上是内存溢出为你收集整理的html – 如何在垂直排序列表?全部内容,希望文章能够帮你解决html – 如何在垂直排序列表?所遇到的程序开发问题。

如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。

欢迎分享,转载请注明来源:内存溢出

原文地址:https://54852.com/web/1084331.html

(0)
打赏 微信扫一扫微信扫一扫 支付宝扫一扫支付宝扫一扫
上一篇 2022-05-27
下一篇2022-05-27

发表评论

登录后才能评论

评论列表(0条)

    保存