How can I centre left aligned text even when it wraps?

后端 未结 5 498
栀梦
栀梦 2020-12-08 07:18

I need to centre a block of left aligned text within a div, but I need the visual width of the text block to be centred not the block itself.

In many cases this may

5条回答
  •  独厮守ぢ
    2020-12-08 07:46

    Content here

    Basically, the first div is your containing element. You need to text-align center.

    Then, in your block div (the blue area), you need to display inline and text align left, then set a margin (the white space you want to remain around it when the text wraps).

提交回复
热议问题