+ 1

Why can't i align the text to the center?

i am trying to align a text to the center using this command: <html> <head><title>page name</title></head> <body> <p align="center"> <h1>Welcome To The Page!</h1> </p> </body> But it doesn't work, i tried removing the header tags and it worked, my question is can i align the text to the center while using the header tags?

13th Jun 2020, 2:26 PM
Ali Muhammed
4 Réponses
+ 2
<p> <h1 align='center'></h1> </p> If you have the p tags alingned to the center it will not work header tag is still aligned to the left
13th Jun 2020, 2:35 PM
Andrei I
Andrei I - avatar
+ 1
Ali Muhammed Please don't use align attribute on html tags, it's obsolete HTML center element. It might not work on new browsers soon. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center Use text-align: center css instead.
27th Jun 2020, 5:12 AM
Calviղ
Calviղ - avatar
0
He probably doesn't know css yet so until he learns it it's a good practice to use attributes
27th Jun 2020, 7:50 AM
Andrei I
Andrei I - avatar
0
Andrei I yet showing to use obsolete attribute is not encouraging, it would mislead other users, especially new user like Ali Muhammed
27th Jun 2020, 8:07 AM
Calviղ
Calviղ - avatar