Separators between elements without hacks

前端 未结 6 922
猫巷女王i
猫巷女王i 2020-12-14 08:18

One thing I often want to do when laying out a website is to have some elements next to each other, with separators between them. For instance, if I have 3 elements, I\'d wa

6条回答
  •  难免孤独
    2020-12-14 08:48

    you can do like this also:

    span {position:relative; margin-left:5px}
    
    span:after {
        content:"|";
        position:absolute;
        left:-5px;
    }
    span:first-child:after {
        content:"";
    }
    

    In this method you can also use others separators like / , \ , .

    http://jsfiddle.net/sandeep/UNnxE/

提交回复
热议问题