How can we bring image in center in html without using css? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How can we bring image in center in html without using css?

In the search results it showed that align="middle" attribute can be used, but its not working.

14th Aug 2019, 3:01 PM
Shraddha Gupta
Shraddha Gupta - avatar
3 Answers
+ 5
You could use the deprecated <center> tag but the reason why CSS did not work is because of the parent's size.
14th Aug 2019, 3:05 PM
Valen.H. ~
Valen.H. ~ - avatar
+ 5
this is the hard way using unicode spacing as far as an actual CSS inline use a <div align='center'> img here </div> keep in mind that <center> tag is depreciated https://code.sololearn.com/WQB955UV1aRA/?ref=app
14th Aug 2019, 3:24 PM
BroFar
BroFar - avatar
+ 2
The align attribute of <img> is obsolete and not supported in HTML5. You should definitely use CSS.
14th Aug 2019, 3:09 PM
Michael
Michael - avatar