Text align HTML | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Text align HTML

What is the code for aligning text to the center in HTML? I tried <div align=“center”>, <align=“center”> and both did not work. I cannot figure out why. And sorry if this is a problem, but I cannot attach the code, as it is on a separate device on another HTML platform.

12th Mar 2020, 7:58 PM
Hanna K.
Hanna K. - avatar
3 Answers
+ 3
I think this solution is not supported in HTML5 anymore. Try <div style="text-align:center"> or do it in CSS
12th Mar 2020, 8:25 PM
Aleksandra Krawiec
Aleksandra Krawiec - avatar
+ 2
<div align="center"> this is right and working properly in my code ,so please try again and take a view of overall html code.
12th Mar 2020, 8:26 PM
Dark Riser
Dark Riser - avatar
0
Hanna K. Please be aware that SoloLearn does have a website and any code loaded on the onto the PlayGround can be seen and ran on the SoloLearn App. Also, keep in mind that it is most likely best to show you code or a snippet of the code in question to get the best answer to help resolve your problem. With that being said the links below should also help you with your problem. https://www.w3schools.com/tags/ref_attributes.asp https://www.w3schools.com/css/css_align.asp
12th Mar 2020, 11:03 PM
ODLNT
ODLNT - avatar