Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Differences between 'url', 'src', and 'href' [duplicate]

Tags:

html

css

url

href

src

Possible Duplicate:
Difference between SRC and HREF

When 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?

like image 360
OneChillDude Avatar asked Aug 20 '12 04:08

OneChillDude


2 Answers

  1. In CSS, it's always url.
  2. In HTML:
    1. It's href (short for Hypertext REFerence) for all kinds of links, including tags a and link.
    2. When it's not a link, you are setting the source, so it's src.
like image 57
behnam Avatar answered Sep 29 '22 22:09

behnam


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.

like image 21
awiebe Avatar answered Sep 29 '22 22:09

awiebe