悬停时将文本转换为图像

时间:2019-03-27 17:22:03

标签: html css html5

im试图在悬停时将文本转换为图像,但一切正常,但图像无法完全转换。这是我的代码:

https://jsfiddle.net/kvmyb4ot/2/

HTML:

<div class="flex-container">
    <div class="flex-item">
         <a href="ArchitectureWork.html">
             <img src="http://milenanimuje.com/wp-content/uploads/2019/03/animacja.png" width="160" height="160" alt="">
         </a>
         <a href="ArchitectureWork.html"><h3 style="text-align: center;">Tekst1</h3></a>
    </div>
 </div>

CSS:

.flex-item > a:first-child         { display: none; }
.flex-item:hover > a:first-child   { display: inline; }
.flex-item:hover > a:last-child    { display: none; }
.flex-container                    { display: flex; }
.flex-item{
background:#f0dcdd;
animation-name: bounceInLeft;
animation-duration: 1s;
animation-fill-mode: both;
padding-top: 70px !important;
padding-bottom: 70px !important;
padding-left: 70px;
padding-right: 70px;
}

1 个答案:

答案 0 :(得分:0)

我想您应该将填充规则重新理解为:padding: 70px 并添加一个新规则:.flex-item:hover { padding: 0 }