Creating links with image

0

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

    
asked by anonymous 23.03.2015 / 02:19

1 answer

2

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


Pure HTML

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

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


UsingCSS:

Iftheimagehasapurelyaestheticfunction,CSSispreferable.

.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 I can better elaborate the points.

    
23.03.2015 / 02:31