2

I am new to HTML. Using www.Codepen.io website, I created a website using HTML to produce a couple of .png pictures, headers and paragraphs. But unfortunately, everything in the website is generating but the pictures. I am not sure why. Do we need to have the .png files in the same area as where the .html file is located? If we do need to save the .html file from Codepen, how do we do so? Am i doing something wrong while writing the script?

Please see attachment for reference: website screenshot

<div>
 <h1>Rohit's page of Interests</h1>
 <img src = "/Users/Roys_laptop/Desktop/Java/java_logo.png" id = "Java logo" />
 <p>My aim is to become a Java Developer one day.</p>
</div>
<div>
 <h1>My Interests</h1>
 <img src = "/Users/Roys_laptop/Desktop/Java/nfl_logo.png" id = "NFL 
  logo" />
 <p> I am a very big football fan. I love and root for the Cinncinnati 
  Bengals </p>
 <img src = "/Users/Roys_laptop/Desktop/Java" id = "Cinncinnati Bengals" />
</div>
4

1 回答 1

2

看起来好像您正在尝试从计算机中抓取图像以进行显示。您的图像需要托管在 Internet 上的某个位置才能被查看。

Codepen.io 确实提供资产托管,但前提是您拥有 Pro 会员资格。此链接更详细地介绍了该链接: https ://blog.codepen.io/documentation/pro-features/asset-hosting/

图像不需要与 html 文件位于同一位置。Web 开发中的常见做法是为图像提供自己的文件夹,以便所有图像都位于同一位置。该主题讨论了站点结构的最佳实践。

至于如何实际链接图像,此线程将详细讨论。

于 2017-06-01T23:32:36.660 回答