Adding Link to code

**Question: How do I add a link to my code I am trying but it keeps saying that the link refuses to connect **

**Repl link: Activist Toolkit: Jasmine H - Replit **

code snippet

Hello @Jazz100 and welcome to the community!

Can you be more specific? What do you mean to add link to my code?

1 Like

I am trying to add a link to a website but I want the link to be attached to an image and I try but it isn’t working

@Jazz100 Welcome to the community!

To make a link, just wrap whatever you’d like the user to press in a <a> tag. For example, if you wanted to make the user have the ability to press a button and be redirected to a page, your code would look like this:

<a href="www.somelink.com">
  <button>Press This To Go To a Awesome Link!</button>
</a>

or, if you wanted to make them press text, it’d look like this:

<a href="www.somelink.com">
  <p>Press This</p>
</a>
3 Likes

Try this:

<a href="https://example.com">
  <img src="https://www.google.com/images/branding/googlelogo/1x/googlelogo_color_272x92dp.png"/>
</a>

Of course, you’ll want to replace example.com with some other link and the link to Google’s logo with some other image (you can also use local files if you leave out the https://). Looking at line 30, you’ve already done this, so would you mind elaborating on your problem or if it’s solved marking a post as the solution?

I have moved this to the HTML/CSS/JS category as those are the languages you’re using.

2 Likes

@Jazz100, welcome to the community!
When it says “Refused to connect”, are you referring to the image not showing up? If so, check the url of your image. If your browser instead shows a big full-screen “so and so refused to connect” error, then make sure that you don’t have a firewall active and potentially messing up your access to the internet.

1 Like