How to display text, a dotted line then more text spanning the width of the page?

前端 未结 6 1910
遇见更好的自我
遇见更好的自我 2020-11-29 10:38

I\'d like to display some text then a dotted line then some more text on the same line on a HTML page e.g.

Name: ............................................         


        
6条回答
  •  没有蜡笔的小新
    2020-11-29 11:11

    My solution is use postion:relative; and position:absolute;

    html

    .............................................................................................................................Name:(Engineer)
    .............................................................................................................................Factory Location:(Not invoice address)

    css

    .row {width:500px;position:relative;}
    .left {position:absolute;left:0;background:white;}
    .right {position:absolute;right:0;background:white;}
    

    Example: http://jsfiddle.net/PyCnT/

    The row has position:relative; and a fixed width. Any span children will will have position:absolute; and using left:0 & right:0 the span moved in the correct place. Adding a background:white override the dots that are in the background of the span.

提交回复
热议问题