【发布时间】:2012-02-16 18:33:06
【问题描述】:
我希望能够将鼠标悬停在图像上并且图像下方的文本会改变颜色。
我的意思的一个例子可以在这个网站上看到,通过将鼠标悬停在任何产品上,下面的文本会变成白色:www.ugmonk.com
这是我的列表项的代码:
<li>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('%s', 'wpzoom'), get_the_title()); ?>">
<?php unset($img); if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
$img = $thumbURL[0]; }
else {
if (!$img) { $img = catch_that_image($post->ID); }
}
if ($img){ $img = wpzoom_wpmu($img); ?>
<img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&w=280&h=280&zc=1" alt="<?php the_title(); ?>"/><?php } ?>
</a>
<div class="meta">
<h3><a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('%s', 'wpzoom'), get_the_title()); ?>"> <?php the_title(); ?></a></h3>
<?php
$price = get_post_meta(get_the_ID(), 'wpzoom_portfolio_overview', true);
$price = do_shortcode($price);
?>
<a href="<?php the_permalink(); ?>"><?php echo $price; ?></a>
</div>
</li>
我尝试过在开头打开'a'标签并在结尾处关闭,如下所示:
<li>
<a href="<?php the_permalink(); ?>" rel="bookmark" title="<?php printf(__('%s', 'wpzoom'), get_the_title()); ?>">
<?php unset($img); if ( current_theme_supports( 'post-thumbnails' ) && has_post_thumbnail() ) {
$thumbURL = wp_get_attachment_image_src( get_post_thumbnail_id($post->ID), '' );
$img = $thumbURL[0]; }
else {
if (!$img) { $img = catch_that_image($post->ID); }
}
if ($img){ $img = wpzoom_wpmu($img); ?>
<img src="<?php bloginfo('template_directory'); ?>/scripts/timthumb.php?src=<?php echo $img ?>&w=280&h=280&zc=1" alt="<?php the_title(); ?>"/><?php } ?>
<div class="meta">
<h3><?php the_title(); ?></h3>
<?php
$price = get_post_meta(get_the_ID(), 'wpzoom_portfolio_overview', true);
$price = do_shortcode($price);
echo $price; ?></a>
</div>
</li>
然后我尝试设置 a:hover 的样式,但无法正常工作!
谢谢
*编辑*
HTML 输出:
<li>
<a href="http://www.domain.com/link" rel="bookmark" title="Description">
<img src="http://domain.com/image" alt="Description"/>
</a>
<div class="meta">
<h3>
<a href="http://www.domain.com/link" rel="bookmark" title="Description">
Product
</a>
</h3>
<a href="http://www.domain.com/link">
<span class="Cart66Price">£15.00</span>
</a>
</div>
</li>
【问题讨论】:
标签: css image text colors hover