javascript - 使用希伯来数字自定义 <ol> 编号

标签 javascript html css

我想要一个使用希伯来字母数字的编号列表,这在希伯来语书籍中很常见。拉丁表示法使用数字 0-9,而希伯来语是按字母顺序编号的,只有少数异常(exception),值会发生变化。我不知道这在 CSS 中是否可行,但也许在 JavaScript 中可行。

我基本上想要这样的东西:

<ol>
  <li>First Line</li>
  <li>Second Line</li>
  <li>Third Line</li>
</ol>

变成这样:

.hebrew-numeral {
  padding-left: 10px;   
}
<table dir="rtl">
  <tbody>
    <tr>
      <td class="hebrew-numeral">א</td>
      <td>First Row</td>
    </tr>
    <tr>
      <td class="hebrew-numeral">ב</td>
      <td>Second Row</td>
    </tr>
    <tr>
      <td class="hebrew-numeral">ג</td>
      <td>Third Row</td>
    </tr>
  </tbody>
</table>

http://jsfiddle.net/rfkrocktk/pFkd7/ :

enter image description here

有没有办法在 CSS 或 JavaScript 中做到这一点?我可以像上面的示例一样使用表格,但这真的是最好的方法吗?

最佳答案

您可以使用 CSS 的 list-style-type: hebrew 属性轻松做到这一点

ol { list-style-type: hebrew; } 
<h1>Test</h1>
<ol>
  <li>One</li>
  <li>Two</li>
  <li>Three</li>
</ol>

请参阅此处示例:http://jsbin.com/icehis/2

关于javascript - 使用希伯来数字自定义 <ol> 编号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7871487/

相关文章:

javascript - 使用 Protractor 控制鼠标移动

javascript - 读取本地json文件

javascript - 我怎样才能通过javascript知道html的显示部分是什么

html - 如何在html和css中垂直对齐div?

javascript - 如何修复: "Failed to load module script ..." Angular 8, Electron 5

javascript - HTML anchor 标签的 onclick 属性不调用 javascript 函数

javascript - VanillaJS Promise 实现替换 jQuery 通知/进度事件

javascript - Bootsnipp 步骤向导无法正确呈现

CSS - 重复的背景图像应该完全可见

html - UL 中的样式堆栈 div