0

Why image is not showing at the output and how to center the image at the output plz help?

https://code.sololearn.com/WF5Q9XKHH8DB/?ref=app

27th Sep 2018, 2:48 AM
Vishal Yadav
Vishal Yadav - avatar
2 Answers
+ 4
Hi. You have a double src= in the <img> tag... The easiest way to center your image, is to nest it inside a centred block element like <div align="center"><img ... /></div> BTW, it's a best practice to have space before the end of a tag that has no ending tag... and the alt="" should describe the image (for accessibility and for best practice reasons) <img src="" ... alt="A tree" /> and not alt=""/> So your code should look like: <html> <head> <title>Image border</title> </head> <body> <h2 align="center">Image border</h2> <p align="center"><i>we can border the outer part of image through border tags </i></p> <div align="center"><img src="http://www.sololearn.com/images/tree.jpg" height="150px" width="150px" border="2px" alt=""/></div> </body> </html>
27th Sep 2018, 3:21 AM
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱
Ronen Gil רונן גיל رونين جيل 🏳️‍🌈♾🇹🇩🇮🇱 - avatar
+ 1
Double src= Add to center images img { display: block; margin: 0 auto; } https://code.sololearn.com/WB5dGtLdxsWN/?ref=app
27th Sep 2018, 3:25 AM
Calviղ
Calviղ - avatar