0
Why image is not showing at the output and how to center the image at the output plz help?
2 odpowiedzi
+ 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>
+ 1
Double src=
Add to center images
img {
display: block;
margin: 0 auto;
}
https://code.sololearn.com/WB5dGtLdxsWN/?ref=app