2016-08-02 41 views
1

我想在用户点击数字时将用户重定向到链接,但锚点标签在点击图像时不起作用。但是,“CLICK HERE”的锚定标签有效。锚标签不与引导程序的数字标签一起工作

<a href="http://google.com"> 
<figure class="effect-ming"> 

<img src="http://example.com/dd.img" alt="Placeholder" /> 

    <figcaption> 
     <p><?php the_title(); ?></p> 
     <a href="<?php the_permalink(); ?>">CLICK HERE</a> 
    </figcaption> 
</figure> 
</a> 

CSS:

figure.effect-ming figcaption::before { 
    border: 0px solid #fff !important; 
    bottom: 30px; 
    box-shadow: 0 0 0 0px rgba(0, 0, 0, 0) !important; 
    content: ""; 
    left: 30px; 
    opacity: 0; 
    position: absolute; 
    right: 30px; 
    top: 30px; 
    transform: scale3d(1.4, 1.4, 1); 
    transition: opacity 0.35s ease 0s, transform 0.35s ease 0s; 
} 
+0

每个锚标记在打开一个新标记之前都需要关闭; * HTML 101 * –

+0

@ Fred-ii-我确实关闭了它,但它没有在栈上正确缩进,所以没有显示,反正我更新了问题 –

回答

1

您需要关闭您的锚标记:

<a href="http://google.com"> 
    <img src="http://example.com/dd.img" alt="Placeholder" /> 
</a> 

<figure class="effect-ming"> 
    <figcaption> 
     <p><?php the_title(); ?></p> 
     <a href="<?php the_permalink(); ?>">CLICK HERE</a> 
    </figcaption> 
</figure> 

我认为这将是更好的。我移动了figure标签,因为嵌套不正确。如果你想要图中的图像,你可以这样做:

<figure class="effect-ming"> 


    <a href="http://google.com"> 
     <img src="http://example.com/dd.img" alt="Placeholder" /> 
    </a> 

    <figcaption> 
     <p><?php the_title(); ?></p> 
     <a href="<?php the_permalink(); ?>">CLICK HERE</a> 
    </figcaption> 
</figure> 
+0

问题依然存在。我认为figcaption在img的顶部,所以不能点击锚标签。 –