html - list-style-image 没有出现在与列表项相同的级别?

标签 html css

我正在为列表项使用图像,但它没有显示在与 li 项相同的级别上。我正在添加指向 fiddle 的链接,请看一下。

 #container {
   background: #e3e3e3;
   margin-top: 50px;
 }
 
 #image {
   margin: 20px;
   width: 900px;
 }
 
 #title {
   text-align: center;
   font-family: Roboto;
   background: -webkit-linear-gradient(#f35626, #feab3a);
   -webkit-background-clip: text;
   -webkit-text-fill-color: transparent;
 }
 
 li {
   line-height: 30px;
   font-family: Roboto;
   font-size: 25px;
   list-style-image: url('https://s3.postimg.org/4qsqurmsj/ic_item_play.png');
 }
<div class="grid_16">

  <ul>

    <li>
      Mark Zuckerberg began programming at a young age--when he was 12 he created a messaging program that his father used in his dental office, allowing the receptionist to notify him of new patients without yelling across the office.
    </li>
    <li>Zuckerberg took a computer graduate class at the nearby Mercy College while still in high school.</li>
    <li>
      His parents even hired a computer tutor to work with the young Zuckerberg, but the tutor admitted that it quickly became difficult to stay ahead of his pupil, referring to him as a "prodigy."
    </li>
 
  </ul>
</div>

https://jsfiddle.net/n2o79mL7/

最佳答案

不要使用list-style-image

在更新的 fiddle 中查看我的更改 - https://jsfiddle.net/n2o79mL7/1/

我基本上已经从 ul 中删除了 padding 并将图像添加为 li 的背景,使用 background-position 和 padding 来正确对齐列表项。

希望这对 friend 有帮助。

关于html - list-style-image 没有出现在与列表项相同的级别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39434343/

相关文章:

css - 如何在 IE8 中使用带有 RowExpander 插件的 ExtJS stripeRows

javascript - 配置特定的 JavaScript 函数以在页面上重新加载

php - 使用哪种语言从 MySql 创建图形数据?

html - 如何找到 :hover state using Chrome's inspector 的 CSS 减速

html - css div居中

css - 将列表项中的 div 居中

html - ASP MVC 无法覆盖 Bootstrap css

CSS::before 和::after 动画到按钮的中心,但只有::after 结束在中心

html - 只有一个外部 css 没有加载到网站中

javascript - 如何制作即使在 iPhone Safari 中也能正常工作的完全响应式背景图片?