• <bdo id='DpQw9'></bdo><ul id='DpQw9'></ul>
  • <small id='DpQw9'></small><noframes id='DpQw9'>

  • <i id='DpQw9'><tr id='DpQw9'><dt id='DpQw9'><q id='DpQw9'><span id='DpQw9'><b id='DpQw9'><form id='DpQw9'><ins id='DpQw9'></ins><ul id='DpQw9'></ul><sub id='DpQw9'></sub></form><legend id='DpQw9'></legend><bdo id='DpQw9'><pre id='DpQw9'><center id='DpQw9'></center></pre></bdo></b><th id='DpQw9'></th></span></q></dt></tr></i><div id='DpQw9'><tfoot id='DpQw9'></tfoot><dl id='DpQw9'><fieldset id='DpQw9'></fieldset></dl></div>

    <tfoot id='DpQw9'></tfoot>
      1. <legend id='DpQw9'><style id='DpQw9'><dir id='DpQw9'><q id='DpQw9'></q></dir></style></legend>
      2. CSS图像悬停改变文本颜色

        CSS image hover change color of text(CSS图像悬停改变文本颜色)
          <legend id='4kqkn'><style id='4kqkn'><dir id='4kqkn'><q id='4kqkn'></q></dir></style></legend>

            <tbody id='4kqkn'></tbody>
        • <i id='4kqkn'><tr id='4kqkn'><dt id='4kqkn'><q id='4kqkn'><span id='4kqkn'><b id='4kqkn'><form id='4kqkn'><ins id='4kqkn'></ins><ul id='4kqkn'></ul><sub id='4kqkn'></sub></form><legend id='4kqkn'></legend><bdo id='4kqkn'><pre id='4kqkn'><center id='4kqkn'></center></pre></bdo></b><th id='4kqkn'></th></span></q></dt></tr></i><div id='4kqkn'><tfoot id='4kqkn'></tfoot><dl id='4kqkn'><fieldset id='4kqkn'></fieldset></dl></div>
          1. <small id='4kqkn'></small><noframes id='4kqkn'>

                <tfoot id='4kqkn'></tfoot>
                  <bdo id='4kqkn'></bdo><ul id='4kqkn'></ul>
                • 本文介绍了CSS图像悬停改变文本颜色的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

                  问题描述

                  我希望能够将鼠标悬停在图像上并且图像下方的文本会改变颜色.

                  I'd like to be able to hover over an image and the text below the image change color.

                  我的意思的一个例子可以在这个网站上看到,通过将鼠标悬停在任何产品上,下面的文本会变为白色:www.ugmonk.com

                  An example of what I mean can be seen on this site, by hovering over any of the products the text below changes to white: www.ugmonk.com

                  这是我的列表项的代码:

                  This is the code for my list item:

                  <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 ?>&amp;w=280&amp;h=280&amp;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'标签并在结尾处关闭,如下所示:

                  I have tried opening the 'a' tag at the beginning and closing at the end like this:

                  <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 ?>&amp;w=280&amp;h=280&amp;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 的样式,但无法正常工作!

                  And then I have tried to style a:hover but can't get it working!

                  谢谢

                  *编辑*

                  *EDIT*

                  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>           
                  

                  推荐答案

                  当您只显示 PHP 代码而不是生成的 HTML 时,很难看到要突出显示的文本的直接路径.但是,使用您提供的第一个代码示例,您可以尝试以下选择器:

                  It is hard to see the direct path to the text you want to highlight when you are just showing your PHP code rather than the generated HTML. However using the first code example you provided, you could try the following selector:

                  a[rel="bookmark"]:hover + .meta * {
                      color: #fff;
                  }
                  

                  编辑

                  抱歉,我删除了 > 选择器,因为它不会针对 h3 元素内的锚标记.如果这不起作用,您可能需要包含更多信息,例如 CSS,因为它适用于我使用上面的代码.

                  Sorry, I have removed the > selector as this would not have targeted the anchor tag inside of the h3 element. You may have to include more information, such as CSS if this is not working as it works for me using your code above.

                  工作示例:http://jsfiddle.net/eqfQb/

                  这篇关于CSS图像悬停改变文本颜色的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

                  本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

                  相关文档推荐

                  Move link image 5px up on hover(悬停时将链接图像向上移动 5px)
                  How do I inspect CSS pseudo classes with firebug?(如何使用 firebug 检查 CSS 伪类?)
                  Why doesn#39;t CSS hover work on table rows when the cells inside the rows have class names?(当行内的单元格具有类名时,为什么 CSS 悬停在表格行上不起作用?)
                  Hover image - display div over it(悬停图像 - 在其上显示 div)
                  How to apply a CSS class on hover to dynamically generated submit buttons?(如何在悬停时将 CSS 类应用于动态生成的提交按钮?)
                  Differences between CSS3 :hover and :focus?(CSS3 :hover 和 :focus 的区别?)
                  • <legend id='tKvbr'><style id='tKvbr'><dir id='tKvbr'><q id='tKvbr'></q></dir></style></legend>

                      <small id='tKvbr'></small><noframes id='tKvbr'>

                        <tbody id='tKvbr'></tbody>
                      <tfoot id='tKvbr'></tfoot>
                          <bdo id='tKvbr'></bdo><ul id='tKvbr'></ul>

                          <i id='tKvbr'><tr id='tKvbr'><dt id='tKvbr'><q id='tKvbr'><span id='tKvbr'><b id='tKvbr'><form id='tKvbr'><ins id='tKvbr'></ins><ul id='tKvbr'></ul><sub id='tKvbr'></sub></form><legend id='tKvbr'></legend><bdo id='tKvbr'><pre id='tKvbr'><center id='tKvbr'></center></pre></bdo></b><th id='tKvbr'></th></span></q></dt></tr></i><div id='tKvbr'><tfoot id='tKvbr'></tfoot><dl id='tKvbr'><fieldset id='tKvbr'></fieldset></dl></div>