html - 将元素符号图标更改为双引号

标签 html css html-lists pseudo-element

我有一个 HTML 列表。 现在我想将元素符号图标更改为双引号图标。

我发现这很有趣 website .

所以我有如下代码:

.listStyle li:before {
  list-style: none;
  content: "\00BB";
}
<ul class="listStyle">
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
</ul>

截图是这样的:

HTML list with bullets and double quotes

我需要双引号图标而不是元素符号图标。 两者并不相邻。

我怎样才能做到这一点?

我需要避免的是当需要换行时该行在同一垂直线上:enter image description here

最佳答案

您正在将 list-style 属性应用于伪元素而不是 li 元素。对于双引号对齐,您可以使用绝对定位:

.listStyle {
  list-style: none;
  padding-left:1.5em;
}
.listStyle li{
  position:relative;
}
.listStyle li:before {
  content: "\00BB";
  position:absolute;
  right:100%;
  width:1.5em;
  text-align:center;
}
<ul class="listStyle">
  <li>SOME TEXT<br/>second line</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
  <li>SOME TEXT</li>
</ul>

关于html - 将元素符号图标更改为双引号,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34270713/

相关文章:

javascript - 检查列表元素是否具有类时需要单击两次

JQuery UI 按钮在鼠标悬停时四处移动

html - 在CSS中格式化类似网格的div

css - 创建 CSS3 形状?

HTML5 UL LI 可拖动

javascript - 如何在 iframe 中显示 db 中的 pdf

javascript - 如何使用 jQuery 让过滤器仅在一列中查找信息?

html - 带有 flexbox 和静态宽度的 CSS 侧边栏

css - ul 列出溢出父 div 的元素

javascript - 随机获取 Li 的单个值并将其打印在 <h1> 标签中