+ 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?
4 Answers
+ 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
+ 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.
0
He probably doesn't know css yet so until he learns it it's a good practice to use attributes
0
Andrei I yet showing to use obsolete attribute is not encouraging, it would mislead other users, especially new user like Ali Muhammed