0

Why this is weird ?

display:block; Width:50% text-align:center;

20th Jul 2021, 6:44 AM
Ankush Panchal
Ankush Panchal - avatar
15 ответов
+ 9
Because of big W and missing ; 🤣🤣 Please clear your question, what do wanna say!
20th Jul 2021, 6:48 AM
Abhiyantā
Abhiyantā - avatar
+ 4
Ankush Panchal Post your code here
20th Jul 2021, 9:02 AM
Abhiyantā
Abhiyantā - avatar
+ 2
If you're trying to center the element inside the parent element, try using: margin: 0 auto;
21st Jul 2021, 7:12 PM
Jakko Jak
Jakko Jak - avatar
+ 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.
21st Jul 2021, 7:58 PM
Jakko Jak
Jakko Jak - avatar
+ 1
put ; after width: 50 %
21st Jul 2021, 4:17 PM
Nshuti Alliance
Nshuti Alliance - avatar
+ 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
21st Jul 2021, 8:09 PM
Panache Sigauke
Panache Sigauke - avatar
+ 1
Nji Franclin Muluh it dose centered for all devices.
22nd Jul 2021, 12:24 PM
Christopher K
Christopher K - avatar
0
Bro..I am using this in h1 tag but it is not working
20th Jul 2021, 6:57 AM
Ankush Panchal
Ankush Panchal - avatar
0
It instead sets the content of h1 to center of h1 not the center of body..
20th Jul 2021, 6:57 AM
Ankush Panchal
Ankush Panchal - avatar
0
I am using text-align:center; in body tag..
20th Jul 2021, 6:58 AM
Ankush Panchal
Ankush Panchal - avatar
0
There is only one h1 inside the body..
20th Jul 2021, 6:58 AM
Ankush Panchal
Ankush Panchal - avatar
0
Do you want to center the h1 tag inside body tag or center the text content inside h1 tag ?
20th Jul 2021, 8:06 AM
Abhay
Abhay - avatar
0
I know how to center it...
20th Jul 2021, 8:10 AM
Ankush Panchal
Ankush Panchal - avatar
0
Christopher K : is this centered for all devices or just phones? cause i don't see what property really centered the <h1>
22nd Jul 2021, 12:11 AM
mulfranck
mulfranck - avatar
0
Im you are trying to make this. https://code.sololearn.com/WRQS7sqy5npf/?ref=app
22nd Jul 2021, 12:21 PM
Christopher K
Christopher K - avatar