I'm having trouble with CSS animations on an HTML element, specifically when it comes to positioning the element freely on the page. How can I achieve this?
I've attempted to use the following code snippet in order to position the HTML element as needed:
<div style="text-align: center;"><p class="animated flipInX">2</p></div>
However, it seems that this approach is not working.
/* CUSTOM STYLES */
body {
background: #011;
padding-top: 5em;
display: flex;
justify-content: center;
}
.typewriter h1 {
color: #fff;
font-family: Consolas,monaco,monospace;
overflow: hidden;
border-right: .15em solid orange;
white-space: nowrap;
margin: 0 auto;
letter-spacing: .15em;
animation:
typing 3.5s steps(30, end),
blink-caret .5s step-end infinite;
}
@keyframes typing {
from { width: 0 }
to { width: 100% }
}
@keyframes blink-caret {
from, to { border-color: transparent }
50% { border-color: white }
}
<html>
<link rel="stylesheet" type="text/css" href="styles.css">
<div class="typewriter">
<h1>1</h1>
</div>
<head>
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.5.2/animate.css">
<p class="animated flipInX">2</p>
</head>
</html>