【问题标题】:How to replicate special characters in html ?如何在 html 中复制特殊字符?
【发布时间】:2016-07-29 01:40:26
【问题描述】:

我需要有看起来像箭头的项目符号点。它们在 MS Word 中提供

如何在 HTML 中复制这些内容?

我将 word 文档保存为 html ,但是那里的 html 非常复杂。是否有可能在 html 页面中更容易地使用这些特殊字符?

【问题讨论】:

标签: html


【解决方案1】:

Word 有一个内置的标准项目符号列表,其中包含要使用的字体。这是 Wingdings 的三 D 顶灯向右箭头。虽然您可以指定该字体并插入正确的字符代码U+F0D8,但如果他们看到正确的字符,则取决于网页查看器的系统。如果字体 Wingdings 不在查看者的系统上,他们(很可能)会看到类似 Ø 的内容——完全错误!

诀窍是指定特定字体,并使用正确的 Unicode 字符。这个箭头是 Unicode 的 List of Dingbat characters 中的 U+27A2

使用 Unicode 字符而不指定字体,将使大多数 Web 浏览器自动扫描其字体以查找包含该字符的字体。

在你的 CSS 中,你可以使用这个:

ul { list-style: none; }
li:before { content: "\27A2"; }

从此以后,您的所有列表都会自动显示您想要的箭头。

有关如何调整缩进的更多选项,请参阅Custom bullet symbol for <li> elements in <ul> that is a regular character, and not an image

【讨论】:

    【解决方案2】:

    只需将特殊字符重新创建为 png/jpg 图像(由于 bg 透明,首选 png)并使用 list-style-image 将项目符号替换为图像,如下所示:

    HTML:

    <ul class=”abcd”>
        <li>Some text here</li>
        <li>Some more text here</li>
        <li>Some more random text here</li>
    </ul>
    

    CSS:

    ul.abcd {
        list-style-image: url(‘/path-to-the-image-file/arrow.png’);
    }
    

    此外,您可以相应地调整图像尺寸。

    【讨论】:

      【解决方案3】:

      我讨厌阅读我将要给出的答案,但我的问题是,您为什么需要那些特定的 microsoft word 项目符号?

      但是,如果您更通用并且只想要一个箭头,那么在堆栈溢出时已经有很多答案了。

      这是一个类似答案的链接:How do I create a Unordered list in html with sub arrows?

      这里有一些代码:

      HTML:

      <ul class="arrow-list">
          <li>San Jaun</li>
      </ul>
      

      CSS:

      ul.arrow-list { list-style:none; }
      ul.arrow-list li:before {
          content: "\2192 \0020";
      }
      

      最后,您可以简单地将其替换为在此页面上找到的用于箭头的任何这些 html 代码,而不是上面 css 中看到的 \1234 格式。 http://character-code.com/arrows-html-codes.php

      【讨论】:

        【解决方案4】:

        enter link description here使用 Unicode 符号“Udddd”:

        [UnicodeArrowSymbols][1]
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2011-09-19
          • 1970-01-01
          • 2019-09-30
          • 2012-11-21
          • 1970-01-01
          • 1970-01-01
          • 2014-07-14
          相关资源
          最近更新 更多