+ 2
Horizontal-align of text doesn't work:(
Can someone introduce how to align text in div to the center? https://code.sololearn.com/WJfSkb5aqPMY/?ref=app
7 Answers
+ 4
Hey look this website there's the solution here
http://howtocenterincss.com/#contentType=text&content.text.lines=1&horizontal=center&vertical=middle&browser.IE=11
I already posted it inside my code so you can now see the working version.
+ 4
I thing the align attribute will work with a block element like div tags. It wonât work in inline element like span tags.
+ 3
Add a special p tag for the text and change div's position to relative(also works without specifying the position)
https://code.sololearn.com/W490tA9dowxb/?ref=app
+ 2
Thanks! That helped me a lot:)
+ 2
Well I don't know how to make it work then.
+ 1
finally it works. Thank you very much 4ur help
0
But i noticed now that the div isn't aligned as we defined in css(top: 50%) I want to use percents in aligning components in my project.