0

I have a simple p tag with some sample text which is currently centred. However, for the text to all align to one side (like what the arrows show below), i would have to use text-align: left;.

Whilst this works, the sample text would no longer in the centre of the webpage.

My current code:

.aligned-p-text {
  margin-top: 50px;
  text-align: center;
  /*unsure how to carry on from here :/ */
}

How could i center the text and align it all with the red line i have shown below? Thanks in advance :D

enter image description here

some_user_3
  • 403
  • 1
  • 5
  • 17
  • Do you mean `text-align:justify;` like we see in newspapers. – Sunderam Dubey Mar 04 '22 at 18:06
  • When a chunk of text breaks across multiple lines, it will also take up the (almost) full width of its container. This means what you're asking is achieved, in practice, by simply using `text-align: left`. If that still doesn't achieve what you want, you'll need to provide more detail on why. For example, by providing sample HTML showing both scenarios and a description of what you feel is wrong with them. – Ouroborus Mar 04 '22 at 18:09
  • Yeah dw the associated question answers it – some_user_3 Mar 04 '22 at 18:15

0 Answers0