使用 css 替换特定字符

新手上路,请多包涵

我在 div 中有一个无序列表

<div class="myClass">
  <ul>
      <li>Login to your account</li>
      <li>Visit the Accounts ? Invoices page</li>
      <li>Click the <span class="bold">Pay Now</span> button</li>
   </ul>
 </div>

我怎样才能替换“?”在第二个 li 中带有“–>”,使用纯 css

原文由 Kashif Imran 发布,翻译遵循 CC BY-SA 4.0 许可协议

阅读 379
1 个回答

现在有办法只用 css 来做到这一点。你必须使用js。 但是 如果这个字符被 <div class="element">?</div> 括起来--- 例如,你可以这样做:http: //jsfiddle.net/csdtesting/uc8h6pz2/

 .element {
  text-indent: -9999px;
  line-height: 0;
  /* Collapse the original line */
}
.element::after {
  content: "New text";
  text-indent: 0;
  display: block;
  line-height: initial;
  /* New content takes up original line height */
}
 <div class="myClass">
  <ul>
    <li>Login to your account</li>
    <li>Visit the Accounts
      <div class="element">?</div>Invoices page</li>
    <li>Click the <span class="bold">Pay Now</span> button</li>
  </ul>
</div>

原文由 Giannis Grivas 发布,翻译遵循 CC BY-SA 3.0 许可协议

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
logo
Stack Overflow 翻译
子站问答
访问
宣传栏