+ 1

The align="center" attribute doesnt work if i add header tags,italic tags etc

<p align="center">welcome</p>. works <p align="center"><h1>welcome</h1></p> doesnt works

24th Jul 2017, 6:17 AM
rishiraj deori
rishiraj deori - avatar
4 Answers
+ 3
h1 is a block element and will take up the whole screenwidth, so technically it is aligned. Try text-align: center; in CSS
24th Jul 2017, 6:20 AM
The Coding Sloth
The Coding Sloth - avatar
+ 3
<h1 style="text-align:center">text</h1>
24th Jul 2017, 6:30 AM
The Coding Sloth
The Coding Sloth - avatar
+ 3
Try this, changing attributes inside the CSS <style></style> tags You can also make a style.css document with all your styling information there <!DOCTYPE html> <html> <head> <style> p, h1 {text-align: center; } </style> </head> <body> <h1>welcome</h1> <p>welcome</p> </body> </html>
24th Jul 2017, 6:34 AM
Aarón Fortuño Ramos
Aarón Fortuño Ramos - avatar
+ 1
its in html
24th Jul 2017, 6:29 AM
rishiraj deori
rishiraj deori - avatar