Difference between SRC and HREF
Posted
by
Vijey
on Stack Overflow
See other posts from Stack Overflow
or by Vijey
Published on 2010-08-03T09:52:44Z
Indexed on
2012/04/09
23:30 UTC
Read the original article
Hit count: 147
html
The SRC and HREF attributes are used to include some external entities like an image, a CSS file, a html file, any other web page or a javascript file.
Is there a clear differentiation between SRC and HREF? where/when to use SRC or HREF? I think they can't be used interchangeably.
I'm giving below few examples where these attributes are used:
To refer a CSS file: href="cssfile.css" inside the link tag
To refer a js file: src="myscript.js" inside the script tag
To refer an image file: src="mypic.jpg" inside an image tag
To refer another webpage: href="http://www.webpage.com" inside an anchor tag
© Stack Overflow or respective owner