indent wrapped text

前端 未结 3 1725
春和景丽
春和景丽 2021-02-07 04:28

So I\'m simulating a table layout with a div and a couple spans inside it. I\'d like the span on the right to indent any text that wraps. I\'ve tried a few things and can\'t ge

3条回答
  •  南方客
    南方客 (楼主)
    2021-02-07 04:50

    Check this out: http://jsfiddle.net/2Wbuv/2/

    .display-element {
    }
    
    .display-label {
      display: inline-block;
      width: 100px;
      padding-left: 5px;
    }
    
    .display-field {
      display: inline-block;
      padding-left: 50px;
      text-indent: -50px;
      vertical-align: top;
      width: 200px; /* for testing purposes only */
    }
    Field 1 This is my string of data, some times it is pretty long. Sometimes it is not. This one is.
    Field 2 This is another string of data.

提交回复
热议问题