hide line beginning and end text separators

后端 未结 3 1082
南旧
南旧 2020-12-30 05:33

two solutions below: one with pure css, the second with jQuery, allowing any kind of symbol/image to be a separator

pre: Fairly hard to formulate an

3条回答
  •  醉话见心
    2020-12-30 06:05

    Yes you can do this but you need to put the | in a tag. Look at this example

    HTML:

    
    

    CSS:

    #tags {
        width: 170px;
    }
    #tags a {
        white-space: nowrap;
    }
    

    JavaScript (jQuery):

    var iTop;
    $("#tags a").each(function() {
        if (iTop < $(this).offset().top) {
            $(this).prev("span").remove();
        }
        iTop = $(this).offset().top;
    });
    

提交回复
热议问题