HTML Elements and Structures Linking at will

Whats the point of wrapping an image link into a text link just to see an image. Can you just take an image link into the anchor tag and get the same results?

1 Like

Hey there @data2191490120 and welcome to the forums :slight_smile:

Iā€™m not quiet sure I understand your question. Could you give me an example?
If you want to make an image function as a link all you have to do is wrap an <img> inside <a> tags:

<a href="file path">
  <img src="picture file path">
</a>

If you are only trying to show the picture as the link there is not need for wrapping it in a text link.

1 Like

Thanks for the quick reply. I was confused on the function of and tag wraped in a tag. I know understand that it turns a image into a way to access a link.

2 Likes

I got it.

If you only want to display the image than there is no reason to add the <a> tag.


On a side note,

In the future you may want to format your code. Because of the way the forums work, indentation is not preserved, and HTML tags are not rendered as raw text without formatting them.

To format your code, simply press this button:

and then copy/paste your code between the backticks:

1 Like

If you put the URL of the image into a link, all that will happen when you click it is a new page will open with the image at the top left, and the rest will be blank.

The idea of having a link around an image is to use the image as a call to action of some sort. The image may be a thumbnail and link may be to a full size image in a gallery.

Clicking a picture of trainers might take you to a product page where you can choose size, color, quantity and add it to your cart.

The range of usage is boundless, but very practical in dev terms.

1 Like