html - 列表样式图像的问题

标签 html css

我的元素符号列表在类作业中使用图像而不是常规元素符号时遇到问题。图片没有放在列表旁边,而是放在单词集中。

这部分的 HTML 如下所示:

     li {
       background: url('http://s30.postimg.org/52wxo16t9/bullet_Image.png') 2px 4px no-repeat;
       display: list-item;
       padding: 3px 3px 3px 20px;
       overflow: visible;
       list-style: none;
     }
<ol>
  <li class="planet">Lorem ipsum dolor sit amet, consectetuer adipiscing elit.</li>
  <li class="planet">Aliquam tincidunt mauris eu risus.</li>
</ol>

最佳答案

您可以通过在 ol 标签中使用 list-style-image 属性轻松地做到这一点。

ol {
    list-style-image: url('your_image_url');
}

example

关于html - 列表样式图像的问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35107351/

相关文章:

javascript - 移动网页的 Twitter 身份验证?

html - 没有媒体查询的响应式 CSS 网格

javascript - 通过 JS 为 .less 样式表设置 href

javascript - Bootstrap 3 弹出窗口滚动不起作用

html - 添加更多文本时 CSS DIV 不会扩展

javascript - 考虑将字体设置为大号或超大号的 Chrome 用户

javascript - 使用 html 属性设置 javascript 变量

javascript - 将大 img src 替换为缩略图 img woocommerce 产品循环

javascript - 在 iFrame 中使用 jQuery 不起作用

html - 如何创建此搜索框动画?