我有一行有一些div,当用户点击这些div时,我希望将它们转发到另一个网站。为此,我将<a>
标记放在div
之外,如下所示:
<div class="row spacing2">
<h3 id="Parceiros">Parceiros</h3>
<a href="http://www.criticalsoftware.com/pt/homepage">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/CriticalSoftware.png">
</div>
</a>
<a href="http://www.globalmediagroup.pt/">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/GlobalMedia.png">
</div>
</a>
<a href="https://www.facebook.com/pfrinvest/">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/pfr.jpg" style="height:100px;width:200px">
</div>
</a>
<a href="http://www.planeta-virtual.pt/">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/PlanetaVirtual.png">
</div>
</a>
<a href="https://www.sonae.pt/pt/">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/Sonae.png">
</div>
</a>
<a href="http://www.agros.pt/">
<div class="col-md-2 spacing4">
<img alt="" class="img img-responsive img-thumbnail" src="parceiros/Agros.png">
</div>
</a>
</div>
&#13;
我不知道为什么,但是当我检查元素时,它说我的a
标签是0px x 0px。如果有人能给我一个提示,我会很感激。
答案 0 :(得分:1)
您需要在标记之外添加col类。
<a href="http://www.criticalsoftware.com/pt/homepage"><div class="col-md-2 spacing4"><img alt="" class="img img-responsive img-thumbnail" src="parceiros/CriticalSoftware.png"></div></a>
<div class="col-md-2 spacing4"><a href="http://www.criticalsoftware.com/pt/homepage"><img alt="" class="img img-responsive img-thumbnail" src="parceiros/CriticalSoftware.png"></a></div>
由于col类具有float: left
属性,因此标记的宽度和高度为0。
答案 1 :(得分:0)
只需将以下css规则添加到您的<a>
代码中:
display:block;