Fill available spaces between labels with dots or hyphens

后端 未结 6 614
栀梦
栀梦 2020-11-30 04:46

I have a page with labels which are contained in a div, the labels has a variable with and i want to fill spaces between both with characters, dots or \'-\'.

For ex

6条回答
  •  無奈伤痛
    2020-11-30 05:39

    Try this: http://jsfiddle.net/FpRp2/4/ (updated, now works in ie7)

    The solution @Marcel gave to use a dashed border instead of text hyphens solved the final issue with IE7.

    (Note, I've only tested in Safari, Firefox and Chrome so far.)

    EDIT: IE8 works. Working on a fix for IE7.

    HTML

    some label some text

    some other label some other text

    CSS

    .outer {
        display: inline-block;
        *display: inline;
        zoom: 1;
        position: relative;
        clip: auto;
        overflow: hidden;
    }
    .container {
        position: relative;
        text-align: right;
        white-space: nowrap;
    }
    .filler {
        position: absolute;
        left: 0;
        right: 0;
        border-bottom: 1px dashed #333;
        height: 50%;
    }
    .label {
        background: white;
        float: left;
        margin-right: 20px;
        padding-right: 4px;
        position: relative;
    }
    .text {
        background: white;
        padding-left: 4px;
        position: relative;
    }
    

提交回复
热议问题