简体   繁体   中英

What does / and _ mean in html?

What does _ and / mean in 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.)

HTML

_ has no specific meaning, it's just a letter.

/ is used in file paths (such as URLs) to denote a change in directory. 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. For more detail, see https://developer.mozilla.org/en-US/docs/Learn/Common_questions/What_is_a_URL

Javascript

As in HTML, _ is just a character; it has no specific meaning in javascript. It is used by a common utility library named " underscore ", and a competing library named " lodash "; if you're seeing this in js code it's probably including one of those libraries. (This is similar to how $ is commonly used for jQuery.)

/ does have a specific meaning in javascript; it's used to denote a regular expression , or as the "division" symbol for math.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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