gpt4 book ai didi

html - 图像不会翻转

转载 作者:行者123 更新时间:2023-11-28 03:15:49 25 4
gpt4 key购买 nike

尝试创建类似这样的效果:http://callmenick.com/tutorial-demos/image-caption-reveal-on-hover/index-2.html

但是我受困于我的代码,它不会完美地翻转。

这是我的 CSS:

/* Paragraphs and Heading 2 styling, change according to your needs */
.slide p, .slide h2 {
color:#ffffff;
padding:10px;
left: -20px;
top: 20px;
position: relative;
}
.slide p {
font-family:'Lato';
font-size:12px;
line-height:18px;
margin: 0;
}
.slide h2 {
font-size:20px;
line-height:24px;
margin: 0;
font-family:'Lato';
}
/* 1. Sliding Up */
.moveup img {
position: absolute;
left: 0;
top: -15px;
width: 100%;
/*Fit the image to its container. the aspect ratio is preserved; the image will not be distorted*/
cursor: pointer;
-webkit-transition: transform 2s ease-in-out;
-moz-transition: top .5s ease-in-out;
-o-transition: top 2s ease-in-out;
transition: transform .5s ease-in-out;
}
.slide:hover img{
-webkit-transform:rotateY(90deg);
backface-visibility:hidden;
/*set to a value to hide the whole image*/
padding-bottom:200px;
}

.slide:hover .a{
-webkit-transform:rotateY(360deg);

/*set to a value to hide the whole image*/
padding-bottom:200px;
}

.a{
transition:.5s ease-in;
}

知道我哪一部分做错了吗?

这是 JSFIDDLE:http://jsfiddle.net/r26bz3xn/2/

提前感谢您的帮助!

最佳答案

如果您要使用该示例,为什么不直接使用它们的结构呢?我要说的是,该教程似乎遗漏了很多使这件事起作用的样式。我希望我能更好地解释你做错了什么,但我在底部添加了一个工作 fiddle 和下面的代码:

HTML

<figure>
<img src="http://beautyblenderdupe.com/wp-content/uploads/2015/01/01.jpg" alt=""/>
<figcaption>
<h2>This is a cool title!</h2>
<span>Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nost.</span>
</figcaption>
</figure>

CSS

.slide figure {
margin: 0;
position: relative;
}

.slide figure img {
display: block;
position: relative;
z-index: 10;
max-width: 100%;
height: auto;
}

.slide figure figcaption {
display: block;
position: absolute;
z-index: 5;
padding: 20px;
-moz-box-sizing: border-box;
-webkit-box-sizing: border-box;
box-sizing: border-box;
}

.slide figure h2 {
font-family:'Lato';
color: #fff;
font-size: 22px;
line-height: 1.2;
font-weight: 700;
margin-bottom: 10px;
}

.slide figure span {
display: block;
font-family:'Lato';
font-size:12px;
line-height:18px;
margin: 0;
color: #FFF;
}


.slide figure figcaption {
top: 0;
left: 0;
width: 100%;
height: 100%;
background-color: rgba(26, 76, 110, 0.5);
text-align: center;
backface-visibility: hidden;
transform: rotateY(-180deg);
transition: all 0.5s;
}
.slide figure figcaption h3 {
margin-top: 150px
}
.slide figure img {
backface-visibility: hidden;
transition: all 0.5s;
}
.slide figure:hover img,
#effect-2 figure.hover img {
transform: rotateY(180deg);
}
.slide figure:hover figcaption,
#effect-2 figure.hover figcaption {
transform: rotateY(0);
}`enter code here`

FIDDLE

关于html - 图像不会翻转,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27948141/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com