How do I align text to the center in HTML ? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How do I align text to the center in HTML ?

Hey guys new here and just learning HTML. I am currently on "HTML attributes" and learning to align text to the center of the screen using the tag. <p align="center" This is the text > </p>. Tried several times on the code playground sometimes copying exactly what it is in the example but the text just stays on the left hand side on the output screen. Can anyone help. Thanks Newbie

24th Dec 2017, 12:47 PM
harry
4 Answers
+ 1
the tag should be like that <p align="center">This is the text</p> not <p align="center"This is the text></p>
24th Dec 2017, 1:17 PM
Mohammed Hany
Mohammed Hany - avatar
+ 1
<p align="center"> this is the text </p> Have you tried like this? the way you wrote there, the text is inside the syntax and it's not correct
24th Dec 2017, 1:16 PM
Welliton Malta
Welliton Malta - avatar
0
Ah found the problem. Cheers guys.
24th Dec 2017, 1:51 PM
harry
0
That's what I have Still not working. Can other tags affect it? Or it's not supported in HTML?
4th Apr 2020, 10:16 PM
Keyshawn Jones
Keyshawn Jones - avatar