Johann Rivera
0
Q:

floating animation of text in CSS

.floating {   
    animation-name: floating; 
    animation-duration: 3s; 
    animation-iteration-count: infinite; 
    animation-timing-function: ease-in-out; 
    margin-left: 30px; 
    margin-top: 5px; 
} 
  
@keyframes floating { 
    0% { transform: translate(0,  0px); } 
    50%  { transform: translate(0, 15px); } 
    100%   { transform: translate(0, -0px); }     
} 
0
<!DOCTYPE html> 
<html> 
  
<head> 
    <title>Floating Animation</title> 
    <link rel="stylesheet" type="text/css"
            href="style.css"> 
</head> 
  
<body> 
    <div class="floating" style= 
            "height: 150px; width: 150px; 
            background: rgb(200, 200, 200); 
            padding: 10px"> 
        Arsalan 
    </div> 
</body> 
  
</html> 
0

New to Communities?

Join the community