Solution 1 :

Hello, fastq123:

Please have a look at this code I put together based on your request. Please note that you will need either vanilla or jQuery to achieve this task, I decided to go with jquery to make it faster but both ways will work.I certainly hope this helps, mate. Happy coding!

// Assign the DOM P element to a variable
p = document.getElementById("paragraph");
// Assing p text to another variable
let strParagraph = p.innerHTML;
// Convert it to an array
let strArray = strParagraph.split(" ");
// Reverse elements in the array
let last_element = strArray[strArray.length - 1];
.reverse {
text-align:center;
width:420px;
}

.reverse { 
  position: absolute; 
  left: 93px; 
  top: 21px; 
  width: 65%; 
  height:60%; 
  display: table; 
}

.reverse p {
  display: table-cell; 
  vertical-align: middle; 
  text-align: justify; 
}

.reverse p::first-line {
text-align: center; 
}
<div class="reverse">
          <p id="paragraph">lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum. lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum. lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum. lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum lorem ipsum.lorem ipsum lorem ipsum.
</p></div>

Problem :

I’m using text-align: center. Unfortunately, this property work like this: the remainder remains at the end:

enter image description here

I need this effect: the remainder remains at the start:

enter image description here

How to get this effect?

Comments

Comment posted by Justinas

There is no such CSS rule. Try adding

Comment posted by fastq123

🙁 I need universal solution, no to specific case

Comment posted by Justinas

Try calculate where to put your

Comment posted by Justinas

It does not make sense: 1. Your text lines then are in reverse order 2. You must manually put line brakes instead of having browser split lines

Comment posted by Alvison Hunter

Apologies for not making sense, however, would you mind sharing your knowledge and enlighten us with the most assertive solution for this matter? Please, we will be glad to learn from you, folk.

By