Join a community that supports you and your coding journey from day one. We strive to be a friendly, supportive community that empowers everyone to be better developers. By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div{
width: 100px;
height: 100px;
background-color: red;
position: absolute;
top: 0;
animation: linear infinite, linear infinite;
animation-name: run, rotate;
animation-duration: 10s, 3s;
}
@keyframes run {
0% {
left: 0;
}
50% {
left: calc(100% - 100px);
}
100% {
left: 0;
}
}
@keyframes...
What I have already in my CSSKeyframes, transitions, and transformations probably. Would you like more documentation? X E.
#peace img {
top: 100%;
position: relative;
animation: linear infinite;
animation-name: run;
animation-duration: 10s;
overflow-x: hidden;
}
@keyframes run {
0% {
left: 0;
}
50% {
left: calc(100% - 100px);
}
100% {
left: 0;
}
}
Ideally yes, because I want both to happen simultaneously.![]()
CSS Transitions
CSS transitions allows you to change property values smoothly, over a given duration.www.w3schools.com
Looks like you should add a transition for your properties so it is smooth and also have a transform of a rotation so that it rotates. Do you want further explanation? X E.![]()
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Document</title>
<style>
div{
width: 100px;
height: 100px;
background-color: red;
position: absolute;
top: 0;
animation: linear infinite, linear infinite;
animation-name: run, rotate;
animation-duration: 10s, 3s;
}
@keyframes run {
0% {
left: 0;
}
50% {
left: calc(100% - 100px);
}
100% {
left: 0;
}
}
@keyframes rotate {
0% {
rotate: 0deg;
}
50% {
rotate: 180deg;
}
100% {
rotate: 360deg;
}
}
</style>
</head>
<body>
<div></div>
</body>
</html>
Code Forum is a community platform where coding enthusiasts can connect with other developers, engage in discussions, ask for help, and share their knowledge with a supportive community. It's a perfect place to improve your coding skills and to find a community of like-minded individuals who share your passion for coding.
We use essential cookies to make this site work, and optional cookies to enhance your experience.