0

Centering Text

I added text-align center but my text is not being centered in the middle of my container/div. https://code.sololearn.com/WFmmBGfvFkEa

16th Apr 2022, 3:01 PM
Junior
Junior - avatar
8 Antworten
16th Apr 2022, 3:49 PM
Lisa
Lisa - avatar
0
To me the text appears centered... text-align centers horizontally on the line. Are you trying to center vertically in the container?
16th Apr 2022, 3:39 PM
Lisa
Lisa - avatar
0
yes, ik its centered technically but i want it in the middle of my div, so ye i want it vertically
16th Apr 2022, 3:40 PM
Junior
Junior - avatar
0
One way could be using flex-box on #txt: display: flex; align-items: center; justify-content: center;
16th Apr 2022, 3:46 PM
Lisa
Lisa - avatar
0
okay, i tried it but it still isnt working Lisa
16th Apr 2022, 3:47 PM
Junior
Junior - avatar
0
thank u!
16th Apr 2022, 3:52 PM
Junior
Junior - avatar
0
Then try: position: center;
18th Apr 2022, 7:06 AM
Onipede David
Onipede David - avatar
0
try it! align="center" or style="text-align:center"
18th Apr 2022, 11:49 AM
feitan
feitan - avatar