简体   繁体   English

/ 和 _ 在 html 中是什么意思?

[英]What does / and _ mean in html?

What does _ and / mean in HTML? _ 和 / 在 HTML 中是什么意思? I am trying to add an image to my site and would like to know what those functions do?我正在尝试将图像添加到我的网站,并想知道这些功能的作用是什么?

I've tried looking through google for the answer.我试过通过谷歌寻找答案。

(I initially wrote this answer thinking you were asking about javascript instead of html; just in case I've included both here because, eh, why not.) (我最初写这个答案时以为你在问 javascript 而不是 html;以防万一我把这两个都包括在这里,因为,嗯,为什么不呢。)

HTML HTML

_ has no specific meaning, it's just a letter. _没有特定的含义,只是一个字母。

/ is used in file paths (such as URLs) to denote a change in directory. /用于文件路径(例如 URL)以表示目录中的更改。 So <img src="/foo/bar/baz.gif"> would find an image named "baz.gif" inside a directory named "bar" inside a directory named "foo", at the root level of the website.因此, <img src="/foo/bar/baz.gif">会在网站根级别的名为“foo”的目录中名为“bar”的目录中找到名为“baz.gif”的图像。 For more detail, see https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL有关更多详细信息,请参阅https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL

Javascript Javascript

As in HTML, _ is just a character;在 HTML 中, _只是一个字符; it has no specific meaning in javascript.它在 javascript 中没有特定的含义。 It is used by a common utility library named " underscore ", and a competing library named " lodash ";它被一个名为“ underscore ”的通用实用程序库和一个名为“ lodash ”的竞争库使用; if you're seeing this in js code it's probably including one of those libraries.如果您在 js 代码中看到它,它可能包含这些库之一。 (This is similar to how $ is commonly used for jQuery.) (这类似于$通常用于 jQuery 的方式。)

/ does have a specific meaning in javascript; /在 javascript 中有特定的含义; it's used to denote a regular expression , or as the "division" symbol for math.它用于表示正则表达式,或作为数学的“除法”符号。

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

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