2

1) I have this image from another website that i want to show in my html page, but it does not work. 2) However if I open a new tab in the browser, take that link and put it in the url, I can see the image. 3) If I do 2 first and then 1, i can see the image in my page, but not if I clear the cache after 1 Any idea how to see the image from my html code ? Thanks

<html>
<head>
</head>
<body>

    <img id="imgMap"  src="https://uk-air.defra.gov.uk/assets/meto-maps/20170319_day1.png"  width="60%" border=1 ></img>

</body>
</html>

2 Answers 2

1

The code you made works, but the problem could be that the server where the image is hosted can block the display of it on other domains/server.

So for you the image will be broken. Are you sure the server you're using is connected to the Internet and that is not blacklisted by the original domain of the image?

Sign up to request clarification or add additional context in comments.

1 Comment

Yes it is connected to internet and it was tried from different machines in different networks in two different countries, and the image does not show up when requested from within the html page. Only if the link is written directly on the browser url tab
0

The width attribute is screwing up the image being displayed because you're using a percentage. According to the <img> documentation on MDN:

width: The intrinsic width of the image in pixels. In HTML 4, either a percentage or pixels were acceptable values. In HTML5, however, only pixels are acceptable.

You can either use the width attribute with pixels (width: 50px), or if you really want to use a perecentage, use CSS styling:

<img id="imgMap" src="https://uk-air.defra.gov.uk/assets/meto-maps/20170319_day1.png" style: width="60%" border=1 >

1 Comment

the width attribute does not make any difference, I can remove it, along with the border attribute, the image still does not shows up

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.