Add HTML tag inside CSS Content property

前端 未结 2 1179
名媛妹妹
名媛妹妹 2020-12-10 13:37

I\'m looking for a way to add an HTML tag for CSS content property inside :after and :before.

Unlike this question which only discusses add

2条回答
  •  囚心锁ツ
    2020-12-10 14:06

    This is probably what you want,

    To put an image to the left of your breadcrumb li links:

    .breadcrumbs li a::before {
        content: "";
        display: block;
        background: url('/img/breadcrumb-icon.png') no-repeat;
        width: 20px;
        height: 20px;
        float: left; /*icon on the left*/
        margin: 0 6px 0 0; /*margin on the right so there is a gap between your icon and link*/
    }
    

    If you want it on the other side try float:right;margin: 0 0 0 6px; or use ::after should get you part of the way

提交回复
热议问题