【问题标题】:Blurring background image not text on hover悬停时模糊背景图像而不是文本
【发布时间】:2017-03-10 12:01:34
【问题描述】:

亲爱的开发者你好,

我在对我的帖子网格进行编码时遇到了问题。我想在悬停时模糊背景图像。但我的文字(在同一个 div 中也很模糊)。您对此有解决方案吗?或者没有其他方法,不在容器中的新 div 中使用此图片。想保留它作为背景图片

帖子php:

<?php if (have_posts()) : while (have_posts()) : the_post(); ?>
            <div class="article" style="background-image: url(<?php echo the_post_thumbnail_url(); ?>);" onclick="self.location.href='<?php echo get_permalink( $leavename = false ); ?>'">
                <div class="post_info">
                    <span class="post_cat"><?php the_category(' ') ?></span>
                    <h2 class="post_title"><a href="<?php the_permalink() ?>"><?php the_title(); ?></a></h2>
                    <span class="post_date"><?php the_time('d.m.Y') ?></span>
                </div>

            <!-- .article --></div>

CSS:

.article:hover {
-webkit-filter: blur(2px);
}
.article {
margin-top: 15px;
position: relative;
height: 229px;
margin-left: 15px;
margin-right: 15px;
float: left;
width: 25%;
cursor: pointer;
}

感谢你帮助我,ExotiQ

【问题讨论】:

    标签: html css image hover blur


    【解决方案1】:

    不能模糊背景图像,但可以模糊任何元素或伪元素

    我会继续为您的问题提供解决方案,但这个总结得很好。 Check out this awnser

    希望能帮到你!

    【讨论】:

    • 谢谢你,伙计。经过一番尝试,我只是将缩略图移到了 div 里面。并将其缩放到相同的大小。但直到现在我还不太习惯于发布 att。但是感谢您的解决方案=D
    • 很高兴我能帮上忙 :)!
    猜你喜欢
    • 2015-10-09
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-04-24
    • 1970-01-01
    • 2013-12-23
    • 2013-01-27
    相关资源
    最近更新 更多