0

我正在尝试制作一个 HTML 锚点,其中包含一个顶部带有可见文本图例的图像。我的代码是:

<li class="grelha lin2 col4">
    <a href="#">
    <img src="img/imagem.gif" alt="Proj">
    <p class="leg normal">Proj</p>
    </a>
</li>

CSS是:

.leg {
    width: 112px;
    height: 12px;
    position: relative;
    bottom: 23px;
    vertical-align: bottom;
    text-align: center;
    padding: 4px;
    font-size: 12px;
    font-size: 1.2em;
    font-weight: bold;
    user-select: none;
    display: block;
    z-index: 1000;
}

.nav {
    color: #ccc;
}

.normal {
    background-color: rgba(255,255,255,0.5);
    color: black;
}

li视觉上一切都很好,但在120x120 像素的框下方继续检测到链接。但视觉上什么都没有。

问题是:如何实现在 SEO 中运行良好的相同结果,并允许我让这个框靠近另一个使用正确链接的框。

4

1 回答 1

1

在这里使用<span>更有意义,因为它是内联元素而不是<p>块元素

<li class="grelha lin4 col1"> 
     <a href="#"> 
         <img src="img/imagem.gif" alt="Proj"> 
         <span>Proj</span>
     </a> 
</li>​

而不是使用 css 以您想要的方式对其进行样式设置

于 2012-12-17T01:14:49.120 回答