Ori*_*n31 0 html css transition css3
我不知道以前是否曾经问过这个问题,但无论我在哪里,答案都没有用.我要做的是移开文本,然后抬起一个灰色的盒子,当我将鼠标从灰色框移开时,灰色框首先向下,然后文本向后移动.使用我的代码,文本首先移回,这看起来不太好.有什么方法可以在恢复正常时撤消转换顺序?这是我的CSS:
.doge{
font-size: 50px;
font-family: "Comic Sans MS";
text-align: center;
background-image: linear-gradient(#c6a65f 70%,#cbc595 80%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-position: left;
transition: 1.6s;
}
.dogediv{
width: 537px;
height: 529px;
background-image: url("https://pbs.twimg.com/profile_images/378800000822867536/3f5a00acf72df93528b6bb7cd0a4fd0c.jpeg");
background-position: right;
position: relative;
}
.div2 {
background-color: gray;
height: 100%;
transition: 5s;
transition-delay: 1s;
}
.div2:hover > .doge{
transform: translateX(550px);
}
.div2:hover {
height: 10px;
}
Run Code Online (Sandbox Code Playgroud)
HTML:
<!DOCTYPE html>
<html>
<head>
<title>Home of the Doge</title>
<link rel="stylesheet" href="styles.css">
</head>
<body>
<div class="dogediv">
<div class="div2" style="background-color: gray">
<h1 class="doge">Welcome to the Home of the Doge</h1>
</div>
</div>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
添加转换延迟:类"doge"上的1s和转换延迟:div2上的0.5s.
.doge{
font-size: 50px;
font-family: "Comic Sans MS";
text-align: center;
background-image: linear-gradient(#c6a65f 70%,#cbc595 80%);
-webkit-background-clip: text;
-webkit-text-fill-color: transparent;
background-position: left;
transition: 1.6s;
transition-delay: 1s;
}
.dogediv{
width: 537px;
height: 529px;
background-image: url("https://pbs.twimg.com/profile_images/378800000822867536/3f5a00acf72df93528b6bb7cd0a4fd0c.jpeg");
background-position: right;
position: relative;
}
.div2 {
background-color: gray;
height: 100%;
transition: 3s;
transition-delay: 0.5s;
}
.div2:hover {
height: 10px;
}
.div2:hover > .doge{
transform: translateX(550px);
transition-delay: 0s;
}Run Code Online (Sandbox Code Playgroud)
<div class="dogediv">
<div class="div2" style="background-color: gray">
<h1 class="doge">Welcome to the Home of the Doge</h1>
</div>
</div>Run Code Online (Sandbox Code Playgroud)
愿这对你有所帮助.
| 归档时间: |
|
| 查看次数: |
122 次 |
| 最近记录: |