+ 1

Need help centering image in Web

Tried using align ="center" in the image tag but that doesn't work, If you can show me an example in both html and css id appreciate it. Code below https://code.sololearn.com/Wv041RuU9RT8/?ref=app

9th Jun 2019, 8:25 PM
StealthyTaco
StealthyTaco - avatar
3 Antworten
+ 1
Hey, align is used for text usually, use the margin-left / margin-right in CSS. Check the code I edited below. https://code.sololearn.com/WPa91gp8hSlU/?ref=app
9th Jun 2019, 8:40 PM
HNNX 🐿
HNNX 🐿 - avatar
+ 1
Attribute align is not working for <img> tags. Wrap the <img> inside an <p align="center"> or use css: img{display:block; margin: 0 auto}
9th Jun 2019, 8:49 PM
Giorgos Mariettakis
Giorgos Mariettakis - avatar
+ 1
Probably not the best way, but this works :D <div align="center"><img></div>
11th Jun 2019, 8:15 AM
Chris Coder
Chris Coder - avatar