0

I have a <p> tag within a <p> tag. I am using the second <p> tag to do formatting of texts in between the line. I want to print those in the same line and align it to the center of the page. I tried few css tricks like text-align:center; display:inline-block; even the simple align:center but since I have other <p> tags within, it breaks into next line.

Can anyone suggest me a feasible way to do this?

<p style="display:inline-block; text-align:center; position: relative">
  Followers:
  <p style="font-size:20px; display:inline-block; text-align:center;">100</p>
  Following:
  <p style="font-size:20px; display:inline-block; text-align:center;">200</p>
  Tweets:
  <p style="font-size:20px; display:inline-block; text-align:center;">2113</p>
</p>
mplungjan
  • 169,008
  • 28
  • 173
  • 236
Libin Thomas
  • 829
  • 9
  • 18
  • 5
    You **can't** nest `

    ` elements. The HTML parsing rules mean that a `

    ` is inserted before the `

    ` implicitly. Try writing meaningful HTML before worry about styling it.

    – Quentin Apr 26 '22 at 09:26
  • 1
    Also please when you post HTML or CSS questions, post HTML instead of server code in a `[<>]` snippet. This is NOT a jinja2 issue at all. I updated your question to a [mcve] – mplungjan Apr 26 '22 at 09:28

1 Answers1

-4

Replace the <p> inside <p> should be solve it

<p style="display:inline-block; text-align:center; position: relative">
  Followers:
  <body style="font-size:20px; display:inline-block; text-align:center;">100</body> <br />
  Following:
  <body style="font-size:20px; display:inline-block; text-align:center;">200</body> <br />
  Tweets:
  <body style="font-size:20px; display:inline-block; text-align:center;">2113</body> <br />
</p>
pshyduc
  • 13
  • 3