我已经尽可能多地尝试了我所知道的这些东西,但未能在图像上显示框阴影。
http://thesameffect.com/healthy-habits-and-distinctions/#related-posts
我想显示覆盖在图像上的阴影。和..一样
请帮助我..
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 中的图像 url。
genesis_get_image(array('format' => 'url'));