Text align HTML | Sololearn: Learn to code for FREE!


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.

3/12/2020 7:58:35 PM

Hanna K.

4 Answers

New Answer


I think this solution is not supported in HTML5 anymore. Try <div style="text-align:center"> or do it in CSS


<div align="center"> this is right and working properly in my code ,so please try again and take a view of overall html code.


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