5 Replies - 812 Views - Last Post: 07 January 2013 - 07:57 AM

#1 Featherly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-July 12

a href and img src. Whats wrong with these codes?

Posted 06 January 2013 - 10:06 PM

 
<!DOCTYPE html>
<html>
	<head>
		<title></title>
	</head>
	<body>
		<img src="http://i.imgur.com/N1GeA.gif"/>
        <a href="http://reddit.com" /><img src="http://i.imgur.com/UwAA6.jpg"></a>
		<a href="http://reddit.com/></a>
		
	</body>
</html> 


I'm doing a lesson on code academy
http://www.codecadem...2#!/exercises/3
 Between the body tags, add two images. One should be a link; the other should not. The link can go anywhere you want.
After your two images, create a link that's just a line of text. It can link anywhere you want.


Is This A Good Question/Topic? 0
  • +

Replies To: a href and img src. Whats wrong with these codes?

#2 Martyr2  Icon User is offline

  • Programming Theoretician
  • member icon

Reputation: 4404
  • View blog
  • Posts: 12,260
  • Joined: 18-April 07

Re: a href and img src. Whats wrong with these codes?

Posted 06 January 2013 - 10:17 PM

This code below has two things wrong... first it has no text in it to serve as the link text. Secondly, you are missing a double quote after the com/ part.

 <a href="http://reddit.com/></a>



Should look like this for standard links...

 <a href="http://reddit.com/">Go to Reddit</a>



Other than that, the rest looks good. :)
Was This Post Helpful? 1
  • +
  • -

#3 Featherly  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 6
  • Joined: 20-July 12

Re: a href and img src. Whats wrong with these codes?

Posted 06 January 2013 - 10:40 PM

I fixed that part but one image still is not a link like it should be. :/
	<a href="http://reddit.com" />
        <img src="http://i.imgur.com/UwAA6.jpg"/>click here </a>
        <img src="http://i.imgur.com/3BTwK.gif" />
        <a href="http://sociallooks.com" >My Company</a>


Was This Post Helpful? 0
  • +
  • -

#4 Anthonidas  Icon User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 221
  • Joined: 25-April 11

Re: a href and img src. Whats wrong with these codes?

Posted 07 January 2013 - 02:59 AM

your second image is not within the <a>-Tags.

this should do the thing...
<a href="http://reddit.com" /><img src="http://i.imgur.com/UwAA6.jpg"/>click here </a>
       <a href="SET_A_URL"><img src="http://i.imgur.com/3BTwK.gif" /></a>
       <a href="http://sociallooks.com" >My Company</a>




Was This Post Helpful? 0
  • +
  • -

#5 raghav.naganathan  Icon User is offline

  • Perfectly Squared ;)
  • member icon

Reputation: 408
  • View blog
  • Posts: 1,440
  • Joined: 14-September 12

Re: a href and img src. Whats wrong with these codes?

Posted 07 January 2013 - 03:12 AM

Well, you need to remove the '/' after the <a href="http://reddit.com" /> tag as that would indicate the closing of the tag.

Instead, you should do like this.

<a href="http://reddit.com" >
        <img src="http://i.imgur.com/UwAA6.jpg"/>click here </a>
        <img src="http://i.imgur.com/3BTwK.gif" />
        <a href="http://sociallooks.com" >My Company</a>


Well, I tried it out and it said That's correct! Next Exercise: Congratulations!

regards,
Raghav
Was This Post Helpful? 1
  • +
  • -

#6 Anthonidas  Icon User is offline

  • D.I.C Head

Reputation: 31
  • View blog
  • Posts: 221
  • Joined: 25-April 11

Re: a href and img src. Whats wrong with these codes?

Posted 07 January 2013 - 07:57 AM

oh of course... did not see this closing tag, sorry ;)/>

This post has been edited by Anthonidas: 07 January 2013 - 07:57 AM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1