Box-shadow未显示或z-index

时间:2012-08-12 17:52:58

标签: html css z-index css3

我尽可能多地了解这些东西,但没有在图像上显示盒子阴影。

http://thesameffect.com/healthy-habits-and-distinctions/#related-posts

我想在图像上显示阴影。像...一样。

http://thesameffect.com/blog/

请帮助我..

HTML:

<div class="related-posts">
    <h3 class="related-title">Related Posts</h3>
    <ul id="related-posts" class="related-list">
        <li>
            <a title="Permanent Link toHow Genetics and Epigentics Relate to Your Health and Fitness" rel="bookmark" href="http://TheSamEffect.com/how-genetics-and-epigentics-relate-to-your-health-and-fitness/">
                <img class="attachment-Header Square" width="297" height="200" title="genes2" alt="genes2" src="http://TheSamEffect.com/wp-content/uploads/genes2-297x200.jpg">
                <span class="related-heading">How Genetics and Epigentics Relate to Your Health and Fitness</span>
            </a>
        </li>

        <li>
            ...
        </li>   

        <li>
            ...
        </li>
    </ul>
</div>

CSS:

.related-posts ul {
    list-style: none outside none;
    margin: 0;
    padding: 0;
}

.related-list li {
    background-color: #F4F4F4;
    box-shadow: 0 0 10px #000000 inset;
    float: left;
    height: 150px;
    list-style: none outside none !important;
    margin: 0.25em !important;
    overflow: hidden;
    position: relative;
    text-align: center;
    width: 216px;
}

.related-posts ul li a {
    font-size: 14px;
    font-weight: normal;
    line-height: 20px;
    text-decoration: none;
}

.related-posts a {
    color: #F4F4F4;
}

.related-list img {
    display: block;
    margin: 0;
    position: absolute;
}

.related-heading {
    background-color: rgba(0, 0, 0, 0.5);
    bottom: 0;
    font-family: Conv_resea-bolditalic,"Helvetica Neue",Arial,Helvetica,sans-serif,georgia;
    font-size: 16px;
    left: 0;
    min-height: 40px;
    padding: 10px;
    position: absolute;
    width: 90.5%;
    z-index: 1;
}

PHP - WP代码:

这就是我如何从创世纪中提取图像。

            $img = genesis_get_image() ? genesis_get_image( array( 'size' => 'Header Square' ) ) : '<img src="' . get_bloginfo( 'stylesheet_directory' ) . '/images/related.png" alt="' . get_the_title() . '" />';

            $related .= '<li><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '">' . $img . '<span class="related-heading">' . get_the_title() . '</span></a></li>';
在完成所有这些事情之后,我仍然无法看到盒子阴影,实际上阴影在它的实际位置,但由于z-index,我认为我无法看到阴影。

请帮助我解决问题。

谢谢。

解决方案后:

以下代码只显示Genesis中的图片网址。

genesis_get_image(array('format'=&gt;'url'));

2 个答案:

答案 0 :(得分:0)

尝试this

之类的内容

http://jsfiddle.net/esnLn/

将图像设置为div背景

答案 1 :(得分:0)

您的阴影位于具有插入阴影的列表项上,列表项中的图像覆盖了它。解决此问题的一种方法是将列表项背景图像设置为图像并删除图像本身。

根据您的更新,您可以尝试:

$img = genesis_get_image( array( 'size' => 'Header Square' ) );
$related .= '<li style="background-image:url('.$img.')"><a href="' . get_permalink() . '" rel="bookmark" title="Permanent Link to' . get_the_title() . '"><span class="related-heading">' . get_the_title() . '</span></a></li>';