Creation of links with image

Asked

Viewed 55 times

0

After placing: <a href="URL do site">, then I should put only the image URL or <img src=''URL da imagem'' ?

  • 1

    Welcome to Stackoverflow in Portuguese. I really did not understand your doubt and even your codes, are without logic to me, could you edit the question and try to be clearer? Grateful

1 answer

2

There are several ways to create an image link. The difference depends on the context and semantics to be used. See the most common ways:


Pure HTML

If the image is part of the page context (not just a graphic effect or a stylized button) use the tag img:

<a href="#"><img 
    src="http://cdn.sstatic.net/stackexchange/img/logos/careers/careers-icon.png"
></a>


Using CSS:

If the image has merely aesthetic function, CSS is preferable.

.logo {
  display:block;
  width:228px;
  height:228px;
  background:url(http://cdn.sstatic.net/stackexchange/img/logos/careers/careers-icon.png);
}
<a href="#" class="logo"></a>


If you can, add more details of your need editing the question, so that I can better elaborate the points.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.