www.webdeveloper.com
Results 1 to 9 of 9

Thread: [RESOLVED] Difference between "src" and "href" attributes.

  1. #1
    Join Date
    Dec 2012
    Posts
    20

    resolved [RESOLVED] Difference between "src" and "href" attributes.

    Hi there guys can someone tell me the simple difference between "src" and "href" attributes??

    Thanks.

  2. #2
    Join Date
    Mar 2012
    Posts
    1,340
    Anchors use href, images use src.

  3. #3
    Join Date
    Dec 2012
    Posts
    39
    SRC is used for referring an image file: src="goodpic.jpg" inside an image tag

    href is used for referring a webpage: href="http://www.nameofwebpage.com" inside an anchor tag

  4. #4
    Join Date
    Dec 2012
    Posts
    20
    Thanks for the reply.
    so src is for the file location? and href is for web address?

  5. #5
    Join Date
    Dec 2012
    Posts
    3
    src refers to image file

    href refers to indicate the webpage.

  6. #6
    Join Date
    Mar 2012
    Posts
    1,340
    Quote Originally Posted by amir786_z View Post
    Thanks for the reply.
    so src is for the file location? and href is for web address?
    No, both can use local or absolute (web) addresses. The difference is just formal. <a> used "href=", <img> uses "src=".

  7. #7
    Join Date
    Dec 2012
    Posts
    19
    the src="" and href="" can b e used in many ways examples . . .

    src="" used for a images example .swf .tiff .gif .png .jpg etc like so . . .
    <img src="lol.png">

    or you could embed a web page . . .

    <embed src="http://example.com" height="500px" width="500px">

    what about href used to make a link. . .

    <a href="http://example.com">my site name</a>

    and both used together as a clickable image. . .

    <a href="http://example.com"><embed src="http://exapmle.com/lol.swf"</a>

    or web page . . .

    <a href="http://example.com"><embed src="http://exapmle.com" height="500px" width="500px"></a>

    just use what's suitable for what you need XD

  8. #8
    Join Date
    Dec 2012
    Posts
    20
    Thanks for the reply guys

  9. #9
    Join Date
    Dec 2012
    Posts
    39
    Welcome Amir
    Last edited by shymajones; 12-19-2012 at 11:55 AM.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles