0
Why this is weird ?
display:block; Width:50% text-align:center;
15 Answers
+ 9
Because of big W and missing ; š¤£š¤£
Please clear your question, what do wanna say!
+ 4
Ankush Panchal Post your code here
+ 2
If you're trying to center the element inside the parent element, try using:
margin: 0 auto;
+ 2
Here you go: https://code.sololearn.com/W3a7a25A18a1
h1{
display:block;
width:50%;
text-align:center;
margin: 0 auto;
border: 1px solid black;
}
^That centers your text inside of the h1, and the margin: 0 auto; will center the h1 inside of its parent element (the body in this case). I added the border around the h1 so you can better see its position on the page.
+ 1
put ; after width: 50 %
+ 1
It cannot be seen what you're tryin to define, like whether it is the h1 or p or body and missing ";" after 50% and maybe that uppercase W
+ 1
Nji Franclin Muluh it dose centered for all devices.
0
Bro..I am using this in h1 tag but it is not working
0
It instead sets the content of h1 to center of h1 not the center of body..
0
I am using text-align:center; in body tag..
0
There is only one h1 inside the body..
0
Do you want to center the h1 tag inside body tag or center the text content inside h1 tag ?
0
I know how to center it...
0
Christopher K : is this centered for all devices or just phones?
cause i don't see what property really centered the <h1>
0
Im you are trying to make this.
https://code.sololearn.com/WRQS7sqy5npf/?ref=app