获取多行文本与内容对齐,而不是使用 OL 和 list-style-type: inside 的数字标签

Moo*_*ing 4 html css

我有一个 OL 元素,里面有 list-style-position: 。但是,如果 LI 元素内的文本是多行的,则下一行上的文本将与编号一起向左对齐,而不是与其他文本对齐。

有什么办法可以解决这个问题吗?

使用的代码:

<style type="text/css">
ol { list-style-position: inside; }
</style>

<ol>
<li>If this text passes to the next line, it's not aligned with the content but with
the numeric label.
</ol>
Run Code Online (Sandbox Code Playgroud)

感谢您的帮助 :)

Ada*_*dam 5

好吧,只需删除list-style-position: inside;(:
您需要的是list-style-position: outside;默认值。
如果您确实需要list-style-position: inside;,可以尝试将padding和设置text-indent为 ol 元素:http://jsfiddle.net/KXdjZ/4/