【问题标题】:Text Underline when Hover over Image将鼠标悬停在图像上时的文本下划线
【发布时间】:2013-08-10 21:41:20
【问题描述】:

我正在慢慢了解 php,但需要一些帮助。 当您将鼠标悬停在帖子缩略图上时,我希望 .rel 中的 h1 标签下划线。 有人能指出我正确的方向吗?

我发现: hover image and text change 但没有答案。 Underlining in Javascript? 但不确定 jquery 在我的情况下如何工作? http://www.kirupa.com/forum/showthread.php?295704-Change-text-hover-when-hovering-over-an-image 但 a href 包裹在图像和文本周围。

我读过 mouseOver 和 mouseOut 函数,但不熟悉这些!

我在 php 中的代码

div id="boxes"

<div class="box">
    <div class="rel">
        <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
        <a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('homepage-thumb', array('alt' => '', 'title' => '')) ?></a>
<?php if ($mulderamanda_theme_options['images_only'] == 0): ?>

        </div>


    </div>
</div>

【问题讨论】:

    标签: php css hover underline


    【解决方案1】:

    试试下面的css:

    .box > .rel > a.thumbnail:hover ~ h1 { text-decoration; underline; }
    

    并添加一个类属性:

    <div class="box">
        <div class="rel">
            <h1><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a></h1>
                <a class="thumbnail" href="<?php the_permalink(); ?>"><?php the_post_thumbnail('homepage-thumb', array('alt' => '', 'title' => '')) ?></a>
    <?php if ($mulderamanda_theme_options['images_only'] == 0): ?> 
       </div>
    </div>
    

    ps: 删除了不匹配的&lt;/div&gt;

    【讨论】:

    • 太棒了!!一切都在 CSS 中!非常感谢@collapsar
    猜你喜欢
    • 2014-03-15
    • 2021-11-08
    • 1970-01-01
    • 2015-08-06
    • 1970-01-01
    • 1970-01-01
    • 2014-05-13
    • 2017-07-19
    相关资源
    最近更新 更多