0

I have a div(content) class where text 1 should be centered and text 2 should be located to right. I tried using position:absolute but it text 2 gets out of the div.

       <div style="text-align: center;">              
          <div>
            <h3 class="content-title">Text1 </h3>              
          </div>
          <div style="position:absolute; right:20px; top:80px;">Text 2</div>
        </div>

Below is an image that I would like to get.

Click here to see the image

Jongpil
  • 15
  • 3

1 Answers1

0

Just add position:relative; to main div and remove top:80px; from the text-2

<div style="text-align: center; position: relative;">              
  <div>
    <h3 class="content-title">Text1 </h3>              
  </div>
  <div style="position:absolute; right:20px; top:0px;">Text 2</div>
</div>
Mubeen Ahmad
  • 428
  • 3
  • 11