当href之后出现斜线时,它意味着什么? [英] What does it means when there is fowards slash after a href?

查看:133
本文介绍了当href之后出现斜线时,它意味着什么?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好我是网络开发的新手。
i正在编写一个网页编码并停留在这一行:

Hello i am a newbie in web development. i am working on coding of a web page and stuck at this line:

<a href="/My_Story">My story</a>

可能会有人告诉我正斜杠的含义在这里我的意思是当我点击 my_Story in(view-source-code of ff)它带我去'我的故事'的html编码类似还有其他链接,如

might someone tell me what does forward slash means here i mean when i click my_Story in (view-source-code of ff) it takes me to html coding of 'my story' similarly there are other links like

<a href="/Media">Media</a>
<a href="/Sponsors">Sponsors</a>

因此,当我们点击媒体或赞助商时,我将被带到媒体的html编码或赞助商。如何做到这一点?斜杠是什么意思?为什么html代码没有直接出现而没有点击My_Story,媒体或赞助商。

so when we click 'Media' or''Sponsors' i am taken to html coding of Media or Sponsors. How this is done?what the slash means?and why does the html code not appears directly WITHOUT clicking My_Story,Media or Sponsors.

你可以查看网站:< a href =http://alexnoren.com/ =nofollow> http://alexnoren.com/

推荐答案

href 开头的正斜杠表示它是一个相对路径,从网站的根开始。

Forward slash at the start of an href means that it's a relative path, starting from the root of the website.

例如,在页面 example.com/folder/page.html 中,

<a href="newpage.html">

指向 example.com/folder/newpage.html ,而

<a href="/newpage.html">

指向 example.com/newpage.html

你能更好地解释一下源代码吗?

Can you explain better the source-code thing?

这篇关于当href之后出现斜线时,它意味着什么?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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