gpt4 book ai didi

css - onHover 的反转动画

转载 作者:行者123 更新时间:2023-11-28 07:32:02 27 4
gpt4 key购买 nike

我正在为我的主页使用 CSS 动画。由于没有 onHover I 的对立面试过that :

但它对我来说真的不起作用。

看到那个:

fiddle https://jsfiddle.net/mus8sdL0/ `

感谢帮助

最佳答案

试试这个..

HTML

<section class="half">
<div id="containertop">
<div class="titletextup">
UP
<br>
<div id="triangle-facing-top"></div>
</div>
</div>
</section>

<section class="half">
<div class="titletextdown">
<div id="triangle-facing-bottom"></div>
<br>
DOWN
</div>
</section>

CSS

@charset "UTF-8";
* {
margin: 0; padding: 0;
}

html, body, #container {
height: 100%;
font-family: 'corbertregular', arial, sans-serif;
font-size:24px;
color:white;
}
header {
height: 50px;
background: gray;
}
main {
height: calc(100% - 50px);
background: green;
}
.half {
height: 50%;
position: relative;
}
.half:first-child {

border-bottom:10px;
border-left:0px;
border-right:0px;
border-top:0px;
border-bottom-color:white;
border-style:solid;
}

#containertop {
background: blue;
height: 100%;
}

.half:first-child > #containertop{
position:absolute;
z-index:1;
width:100%;
top:0px;
transition: 2s all ease;
}

.half:first-child:hover > #containertop{
top: -100%;
}

.half:last-child {
background: green;
border-top:10px;
border-bottom:0px;
border-left:0px;
border-right:0px;
border-top-color:white;
border-style:solid;
}

.titletextup{
text-align:center;
}

.titletextdown{
text-align:center;
}

#triangle-facing-top {
display: inline-block;
margin: 72px;
border-right: 24px solid; border-bottom: 24px solid;
width: 120px; height: 120px;
transform: rotate(-135deg);
display: inline-block;
-webkit-transform:rotate(-135deg);
-moz-transform:rotate(-135deg);
-o-transform:rotate(-135deg);
color: white;
}

#triangle-facing-bottom {
display: inline-block;
margin: 72px;
border-right: 24px solid; border-bottom: 24px solid;
width: 120px; height: 120px;
transform: rotate(45deg);
display: inline-block;
-webkit-transform:rotate(45deg);
-moz-transform:rotate(45deg);
-o-transform:rotate(45deg);
color:white;
}

看看这个 Fiddle


底部和顶部动画 Check out this fiddle

关于css - onHover 的反转动画,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31450960/

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