+ 2
Hiw to align a text to center along with changing the width of the background color
h1{ Color: crimson; Text-align:center; Background-color:red; Width:50%}
13 ответов
+ 2
its still in the center
https://code.sololearn.com/WhfAotbvqve0/?ref=app
maybe your problem is h1 is not in the center of its parent.
not the text inside the h1
+ 1
I did but it is not working when I use the width option
+ 1
Could you please tell me how to fix this
+ 1
Yes
+ 1
This is it
+ 1
The problem is with h1
+ 1
So you have added an ID for head and fixed the problem
0
use text-align: center in the text container
0
you have the code ?
0
can i see it ?
0
yes, so h1 is centered relative to its parent