Skip to content

Instantly share code, notes, and snippets.

@zocom-christoffer-wallenberg
Last active February 7, 2020 09:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zocom-christoffer-wallenberg/47678355585702101b9513600e2aebb9 to your computer and use it in GitHub Desktop.
Save zocom-christoffer-wallenberg/47678355585702101b9513600e2aebb9 to your computer and use it in GitHub Desktop.
Transitions
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<link rel="stylesheet" href="style.css">
<title>Transition - example</title>
</head>
<body>
<section class="box">
<h2>It's Levi-o-sa, not Levio-sar</h2>
<h3>-Hermione Granger</h3>
</section>
</body>
</html>
{
"scripts": [],
"styles": []
}
body {
margin: 0;
padding: 0;
height: 100vh;
}
.box {
width: 250px;
height: 250px;
border: 1px solid #000000;
color: #ffffff;
transition: background 1s, width 1s, height 1s;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
}
.box h2 {
transform: translateY(-999px);
transition: transform 1s linear 0.5s;
}
.box h3 {
transform: translateX(-999px);
transition: transform 1s linear 1.5s;
}
.box:hover h2 {
transform: none;
}
.box:hover h3 {
transform: none;
}
.box:hover {
background: #000000;
width: 100%;
height: 100%;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment