Skip to content

Commit cc6509d

Browse files
committed
Transform, Transition and Animation - Translate Hero Example
1 parent 27d46b5 commit cc6509d

File tree

2 files changed

+25
-20
lines changed

2 files changed

+25
-20
lines changed

index.html

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,16 @@
1111
</head>
1212

1313
<body>
14-
<div class="one"></div>
15-
<div class="two"></div>
16-
<div class="three"></div>
14+
<div class="hero">
15+
<div class="hero-center">
16+
<h1>hello world</h1>
17+
<p>
18+
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aut quos quia
19+
asperiores incidunt accusantium tenetur saepe, eaque sequi? Ipsum
20+
dicta illo corrupti voluptatibus minus explicabo quae officia odit
21+
consequuntur distinctio!
22+
</p>
23+
</div>
24+
</div>
1725
</body>
1826
</html>

styles.css

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,22 @@
11
/*
2-
transform:translate(),scale()rotate(),skew()
2+
transform:translate() - Hero Example
33
*/
44

5-
div {
6-
width: 150px;
7-
height: 150px;
8-
display: inline-block;
5+
* {
6+
margin: 0;
97
}
108

11-
.one {
12-
background: red;
13-
transform: translateX(75px);
9+
.hero {
10+
min-height: 100vh;
11+
position: relative;
1412
}
1513

16-
.two {
17-
background: blue;
18-
transform: translateY(-40px);
19-
}
20-
21-
.three {
22-
background: green;
23-
/* transform: translateX(50%); */
24-
transform: translate(200px, 200px);
14+
.hero-center {
15+
border: 2px solid red;
16+
position: absolute;
17+
top: 50%;
18+
left: 50%;
19+
transform: translate(-50%, -50%);
20+
min-width: 300px;
21+
text-align: center;
2522
}

0 commit comments

Comments
 (0)