+ 2

How can you center a picture

<!-- how can I center this image--> <img src="......"/>

7th Jul 2019, 6:00 AM
Mark Barnes
3 Answers
+ 4
But this won't work in HTML5. <img src="*.jpg" align="middle"> HTML5 doesn't support align attribute of <img>. Use CSS instead. Good luck with the code!
7th Jul 2019, 6:13 AM
Aquimed - avatar
+ 2
Attribute align and center tag have been deprecated since html4, please do not use <img align="center" ... or center tag. https://developer.mozilla.org/en-US/docs/Web/HTML/Element/center http://support.moonpoint.com/network/web/html/css/align-obsolete.php Use css to center the image .img { display: block; margin: 0 auto; } Or use background-image on body eg. body { background: #fff url(https://www.comics-zone.com/63204-large_default/pop-dc-animated-batman-catwoman.jpg) center center / contain no-repeat; } https://code.sololearn.com/WO8vn04KCK1a/?ref=app
7th Jul 2019, 6:58 AM
Calviղ - avatar
use the center tag in HTML5
7th Jul 2019, 6:02 PM
SpaceJunk - avatar