简体   繁体   English

如何从您自己的文件夹中获取图像

[英]How to source an image from your own folder

New to HTML coding HTML编码新手

I have a folder containing a) my HTML file for my homepage b) a folder called images 我有一个文件夹,其中包含a)我的主页的HTML文件b)一个名为images的文件夹

In my image tag if I copy and paste the whole url from my c drive C:..... then the image works. 在我的图片标签中,如果我从我的c驱动器C复制并粘贴整个网址:.....那么图像可以正常工作。

I want to use a shorted URL I have tried src="\\images(imagename).gif" 我想使用我尝试过的短网址src =“\\ images(imagename).gif”

but it wont work, I was sure this was the the right URL as its a folder in the same folder as my html document... 但它不会工作,我确信这是正确的URL,因为它是与我的html文档在同一文件夹中的文件夹...

Any help is much appreciated 任何帮助深表感谢

As you mentioned, your images folder is in the same location as your HTML. 如您所述,您的图像文件夹与HTML位于同一位置。 So, you should be able to access the images like: 因此,您应该能够访问如下图像:

src="images/myimage1.gif"

Based on your comment below, your code looks as if there are a couple of typos. 根据您在下面的评论,您的代码看起来好像有一些拼写错误。 This line: 这一行:

<img src="images/cartmanbane.gif"" alt="cartman" height="285" width="497>

Should be this (you have quotes where they don't belong): 应该是这个(你有他们不属于的引号):

<img src="images/cartmanbane.gif" alt="cartman" height="285" width="497">

You should notice here on the site that the highlighting is different between those two lines as well. 您应该在网站上注意到这两行之间的突出显示也不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM