本地网站的HTML图像 [英] HTML image for a local site
问题描述
我是HTML新手,对图片有一个快速问题。下面我有一个简单的HTML文件,我正在玩。我想把一个图像放在它的存储在我的网站的主目录中。
<!DOCTYPE html>这个网站是本地的,在我的macbook上。
< html>
< body style =background-color:yellow;>
< h1>我的第一个标题< / h1>
< p>我的第一段。< / p>
< p style =color:blue; margin-left:20px;>这是一段。< / p>
< p style =background-color:green;>这是一段。< / p>
< img src =HoneyBadger.jpgalt =脾气暴躁的蜜獾>
< / body>
< / html>
然而,当我用浏览器打开文件时,我看到一个断开的链接。如果我在浏览器中查看图像的URL,那么是
file:/// Users / admin / Sites / project_honey_badger /%C3%A2%E2% 82%AC%C5%93HoneyBadger.jpg%C3%A2%E2%82%AC%C2%9D
一些随机百分比符号和文字已被添加进来?任何想法我做错了什么?
谢谢
在语法突出显示Stackoverflow已添加。您正在使用(U + 201C:左双引号)和
(U + 201D:右双引号MARK)您应该使用
(U + 0022:引号)。
这通常是由于使用文字处理器编写HTML(自动替换打印引号时打开直引号)而不是文本编辑器。 .stack.imgur.com / j1ucN.pngalt =缩放图像>
I'm new to HTML and have a quick question with regards to images. Below I have a simple html file I was playing around with. I wanted to put an image into it which is stored in the home directory of my site. The site is local, on my macbook.
<!DOCTYPE html>
<html>
<body style="background-color:yellow;">
<h1>My First Heading</h1>
<p>My first paragraph.</p>
<p style="color:blue;margin-left:20px;">This is a paragraph.</p>
<p style="background-color:green;">This is a paragraph.</p>
<img src="HoneyBadger.jpg" alt="Grumpy honey badger">
</body>
</html>
However when I open the file with my browser I see a broken link. If I look at the URL of the image in my browser it is,
file:///Users/admin/Sites/project_honey_badger/%C3%A2%E2%82%AC%C5%93HoneyBadger.jpg%C3%A2%E2%82%AC%C2%9D
Some random percent signs and text have been added in? Any idea what I am doing wrong?
Thanks
Look at the syntax highlighting Stackoverflow has added. You are using "
(U+201C: LEFT DOUBLE QUOTATION MARK) and "
(U+201D: RIGHT DOUBLE QUOTATION MARK) where you should be using "
(U+0022: QUOTATION MARK).
This is usually caused by writing HTML using a word processor (with automatic replacement of straight quotes with typographic quotes turned on) instead of a text editor.
这篇关于本地网站的HTML图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!