Differences between 'url', 'src', and 'href'
38,892
Solution 1
- In CSS, it's always
url
. - In HTML:
- It's
href
(short for Hypertext REFerence) for all kinds of links, including tagsa
andlink
. - When it's not a link, you are setting the source, so it's
src
.
- It's
Solution 2
src -- I want to load up this resource for myself.
href -- I want to refer to this resource for someone else.
url -- A script wants to use this url as a variable.
Author by
OneChillDude
Updated on August 20, 2022Comments
-
OneChillDude over 1 year
Possible Duplicate:
Difference between SRC and HREFWhen writing html/css, it seems like these all do the exact same thing. Obviously this is not the case, and if you 'href' when your supposed to 'src' your gonna have a bad time. But my question is, is there an easy way to remember which ones do which, and when they are used?
-
BoltClock over 11 yearsNot necessarily a variable. A URL is just that: a URL.
-
John Yin over 10 yearsmore information in here: stackoverflow.com/questions/3395359/…
-
Premraj about 8 yearsurl is value of src and href attribute