how to put list item text and list item image in same line?

后端 未结 1 596
野趣味
野趣味 2021-01-20 05:41

HTML:-



        
相关标签:
1条回答
  • 2021-01-20 06:23

    You can use it as a pseudo element and you will have better control on the position and also the size:

    ul {
      list-style:none;
    }
    
    li {
      position:relative;
    }
    li:before {
      content:"";
      position:absolute;
      top:2px;
      left:-20px;
      width:16px;
      height:16px;
      background:url(https://i.stack.imgur.com/yGSp1.png);
    }
    <ul>
      <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit, consequatur?</li>
      <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit, consequatur?</li>
      <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit, consequatur?</li>
      <li>Lorem ipsum dolor sit amet, consectetur adipisicing elit. Reprehenderit, consequatur?</li>
    </ul>

    0 讨论(0)
提交回复
热议问题