html - 在包含内容的列表中包含一个箭头并移动到 li 内容上

标签 html css

我想移动我的 li 的内容。

我在 li 之前添加了箭头:

ul {
    list-style-type: none;
}

li:before {
    content: "\25ba\00a0";
}

看起来很糟糕:

enter image description here

http://jsfiddle.net/Vj8dd/293/

有可能解决这个问题吗?

最佳答案

您可以使用 position: absolute 放置图标。

在列表项上添加一些左缩进,这样它总是从前面几个像素开始,并且文本在换行后正确对齐。

ul {
  list-style-type: none;
}

li {
  position: relative;
  padding-left: 20px;
}

li:before {
  content: "\25ba\00a0";
  position: absolute;
  left: 0;
  top: 0;
}
<form>
  <div style="max-width:200px;">
    <ul>
      <li>foo</li>
      <li>basdasdasfs fgsdfgrfgfg fgf gdf g sdfgd fgdf fg fg r</li>
    </ul>
  </div>
</form>

关于html - 在包含内容的列表中包含一个箭头并移动到 li 内容上,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/41868827/

相关文章:

html - 使用对象标签在 html 中显示内联 pdf

CSS 在框列中垂直对齐

CSS 空间起源未知

jquery - 隐藏透明标题下的滚动页面内容

javascript - 如何用Javascript模拟输入框的输入?

HTML 目标属性在 Internet Explorer 中无法正常工作

html - GWT:从小部件获取带有 css 的 html

html - 在哪里可以找到 Bootstrap 和 Font Awesome 最新的 CDN 链接?

javascript - 在单选按钮选择上显示或隐藏表单

html - 缺少属性的子菜单对齐