html - CSS ul li 格式化
问题描述
我一直在试图弄清楚如何在编号列表和文本之间放置空格,并且仍然让文本很好地环绕在它上面的行之下。我在 Stack Overflow 上找到了一些有效的脚本,但由于某种原因,我只能得到项目符号,没有数字。
谢谢。
ul {
margin: 0;
padding: 50;
}
/* The wider the #list_wrapper is, the more columns will fit in it */
#list_wrapper {
width: 1000px
}
/* The wider this li is, the fewer columns there will be */
ul.multiple_columns li {
text-align: right;
float: right;
list-style: decimal;
height: 30px;
width: 400px;
}
<form id="form1" runat="server">
<div>
<div id="list_wrapper">
<ul class="column-count: 2;">
<li>One: If I knew how to spell the ABC's I would write and write and write and write and write and write and write some more and write and write and write and write and write and write and write.</li>
<li>Two</li>
<li>Three</li>
<li>Four</li>
<li>Five</li>
<li>Six</li>
<li>Seven</li>
<li>Eight</li>
<li>Nine</li>
</ul>
</div>
</div>
</form>
解决方案
将任何东西ul
(无序列表)更改为ol
(有序列表)。
CSS变成:
ol{
margi... }
ol.multiple_columns li{
text-align: right;
float: ri... }
HTML 变为:
<ol class="column-count: 2;">
<li>One: If I knew ...</li>
<li>Two</li>
...
</ol>
为了使列表编号变为粗体,而不是文本,您可以将ol
CSS 中的类更改为包括font-weight:900;
:
ol {
margin: 0;
padding: 50;
font-weight: 900;
}
然后将您的文本包装<li>
为 include <span style="font-weight:normal;"></span>
,如下所示:
<li><span style="font-weight:normal;">One: If I knew how to spell ... </span></li>
没有跨度将文本恢复为正常重量,数字和文本都将是粗体。顺便说一句,font-weight
范围从 100-900。900
是可用的最重的重量。
推荐阅读
- json - 如何使用 Wix 代码显示 json 获取结果?
- c++ - C++ 模式输出
- python - builtins.TypeError:“按钮”对象不可调用
- android - URL查询改造2
- null - 如何排除 varchar2 值不为空但导出为空的行
- python - Python; 尝试逐行添加这些文件,中间有一个选项卡
- android - Android 房间异常
- java - 使用 Glide 时类与同名包冲突
- android - 为什么 Google 无法使用 FirebaseUI 登录?
- java - Java - 未为 MessagePack 类型定义方法 newDefaultUnpacker(byte[])