Use FontAwesome or Glyphicons with css :before

前端 未结 8 932
小蘑菇
小蘑菇 2020-12-07 10:59

Is there any way to embed HTML in the css content: element when using a :before pseudo-element?

I want to use a Font Awesome (or Glyphicon)

8条回答
  •  被撕碎了的回忆
    2020-12-07 11:39

    In the case of your list items there is a little CSS you can use to achieve the desired effect.

    ul.icons li {
      position: relative;
      padding-left: -20px; // for example
    }
    ul.icons li i {
      position: absolute;
      left: 0;
    }
    

    I have tested this in Safari on OS X.

提交回复
热议问题