[英]Align text in an ordered list
I'm constructing HTML from XML ( TEI ) source and need to implement line numbering.我正在从 XML ( TEI )源构建 HTML 并且需要实现行号。 the allignment of the text is not satisfactory as you may see:
如您所见,文本的对齐方式并不令人满意:
Currently, it looks in HTML like this目前,它在 HTML 中看起来像这样
<br label="#region_1641631166648_18l8">
9 liecht •Und got ſach das liecht ,
<br label="#region_1641631166648_18l9">
10 das es gut was vnd ſchid das
<br label="#region_1641631166648_18l10">
The approaches with table or list would not be a good option because of how HTML is created with XSLT and how source data looks like.由于 HTML 是如何使用 XSLT 创建的以及源数据的外观,因此使用表或列表的方法不是一个好的选择。 So maybe there are any other alternatives like using
<span>
and CSS?所以也许还有其他选择,比如使用
<span>
和 CSS?
It seems you have control over the generated html.看来您可以控制生成的 html。 So you could enclose the numbers in a
<span>
tag and style it with css.因此,您可以将数字括在
<span>
标记中,并使用 css 对其进行样式设置。 Something like:就像是:
.lineNumber { display: inline-block; width: 3em; text-align: right; margin-right: 2em; }
<br label="#region_1641631166648_18l8"> <span class="lineNumber">9</span>liecht •Und got ſach das liecht, <br label="#region_1641631166648_18l9"> <span class="lineNumber">10</span>das es gut was vnd ſchid das <br label="#region_1641631166648_18l10">
With this you could also align the numbers correctly underneath.有了这个,您还可以正确对齐下方的数字。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.