how to center an image using html? | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
0

how to center an image using html?

<img src="photo.jpg" height="240px" width="320px" align="center"> align="center" dose not work.

19th Mar 2019, 4:21 PM
Arnab Chakma
Arnab Chakma - avatar
3 Antworten
+ 6
The align attribute of <img> is not supported in HTML5. Try this: <div style="text-align:-webkit-center" > <img src="photo.jpg" height="240px" width="320px"> </div>
19th Mar 2019, 4:43 PM
VEDANG
VEDANG - avatar
+ 2
you should type: <style> figure { display: inline-block ; text-align: center ; } </style> in the head
18th May 2019, 11:56 AM
Ayman Moubayed
Ayman Moubayed - avatar
0
Here is an example using flexbox https://code.sololearn.com/WQt9QH8Q20Dn/?ref=app
19th Mar 2019, 8:12 PM
Jorge
Jorge - avatar