Force single line of text in element to fill width with CSS

后端 未结 1 447
独厮守ぢ
独厮守ぢ 2020-12-09 03:14

I have a div element that holds one line of text. How can I get this text to fill the width 100%?

text-align:justify is only working on ele

相关标签:
1条回答
  • 2020-12-09 03:27

    Try this:

    div {
      text-align: justify;
    }
    
    div:after {
      content: "";
      display: inline-block;
      width: 100%;
    }
    

    jsFiddle

    Take a look here for more info.

    0 讨论(0)
提交回复
热议问题