You need to position the div block horizontally in the center of the parent block, and the contents of the div block should be horizontally positioned on the right edge of the block.
.parent { margin-top: 50px; border: 1px solid black; padding: 20px; } .child { margin: 0 auto; border: 1px solid green; padding: 10px; } .text-right { text-align: right; } <div class="parent"> <div class="child"> <div class="text-right"> text 1 </div> <div class="text-right"> text 2 </div> </div> </div> Text 1 and Text 2 should be in the middle and on different lines. I can not understand what to add is necessary.