为什么我的一些HTML内部链接工作,而另一些不是? [英] Why are some of my HTML internal links working and others not?

查看:168
本文介绍了为什么我的一些HTML内部链接工作,而另一些不是?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

帮助,我对这个世界来说是全新的。



我在首页上做了一个菜单栏,链接到网站上的其他页面,以下是代码示例:

 < ul id =menu> 
< li>< a href =file:///Users/tamborine/Downloads/about_page.htm>关于< / a>< / li>
< li>< a href =file:///Users/tamborine/Downloads/the_therapist_page.html>治疗师< / a>< / li>
< li>< a href =file:///Users/tamborine/Downloads/pay_what_you_can_page.htm>支付你可以< / a>< / li>
< li>< a href =file:///Users/tamborine/Downloads/projects_we_support_page.htm>我们支持的项目< / a>< / li>
< li>< a href =file:/// Users / tamborine / Downloads / resources_page>资源< / a>< / li>
< li>< a href =file:/// Users / tamborine / Downloads / prices_page>价格< / a>< / li>
< li>< a href =file:///Users/tamborine/Downloads/faq_page.htm> FAQ< / a>< / li>
< / ul>

当我在浏览器中打开第一个链接(关于)时,其他的显示找不到文件'在浏览器中



我一直在搜索论坛并检查元素,显示html中不存在的奇怪字符。我在想编码错误?我在Mac上使用TextEdit。我尝试使用TextEdit设置,文件格式是纯文本,编码尝试使用UTF-8和ASCII,但不改变。



我以前在另一台电脑上使用记事本和互联网浏览器,当我做了第一页(关于),这是现在唯一的链接。现在我在mac上,用TextEdit和Firefox。



想法?谢谢你

解决方案

你有智能报价 ,除了第一个链接。这些智能引号被认为是URL的一部分,导致浏览器错误地解析您的URL。



确保OS X不会自动将双引号转换为智能双引号当您键入它们时,引用。即使TextEdit处于纯文本模式也可能发生。转到TextEdit中的编辑>替换,确保智能报价未被选中。您还可以在系统偏好设置>键盘>文本>使用智能引号和破折号中禁用此系统范围。您还可以选择一个功能齐全的源代码编辑器,如Sublime Text,而不是使用TextEdit。


Help, I am totally new to this world.

I am making a menu bar on front page to with links to other pages on the site, here is example of code:

<ul id="menu">
<li><a href="file:///Users/tamborine/Downloads/about_page.htm">About</a></li>
<li><a href="file:///Users/tamborine/Downloads/the_therapist_page.html">The Therapist</a></li>
<li><a href="file:///Users/tamborine/Downloads/pay_what_you_can_page.htm">Pay what you can</a></li>
<li><a href="file:///Users/tamborine/Downloads/projects_we_support_page.htm">Projects we support</a></li>
<li><a href="file:///Users/tamborine/Downloads/resources_page">Resources</a></li>
<li><a href="file:///Users/tamborine/Downloads/prices_page">Prices</a></li>
<li><a href="file:///Users/tamborine/Downloads/faq_page.htm">FAQ</a></li>
</ul>

When I open in browser only the first link (About) works, the others show 'File not Found' in browser

I've been searching forums and inspect element shows strange characters not present in html. I'm thinking encoding error? I am using TextEdit on mac. I tried playing with TextEdit settings, file format is plain text, encoding tried with UTF-8 and ASCII but no change.

I was previously on another computer using notepad and internet explorer when I made the first page (About) that is the only link that actually works now. Now I'm on mac, with TextEdit and Firefox.

Ideas? Thank you kindly

解决方案

You have smart quotes " " in all but the first link. Those smart quotes are considered part of the URL which causes the browser to resolve your URLs incorrectly.

Make sure that OS X isn't automatically converting your double quotes into smart double quotes as you type them. This can happen even while TextEdit is in plain text mode. Go to Edit > Substitutions in TextEdit and make sure Smart Quotes is unchecked. You can also disable this system-wide in System Preferences > Keyboard > Text > Use smart quotes and dashes. You can also opt for a fully-featured source code editor like Sublime Text, rather than using TextEdit.

这篇关于为什么我的一些HTML内部链接工作,而另一些不是?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆