css animation
CSS
<style>
.my-element {
width: 100%;
height: 100%;
animation: tween-color 5s infinite;
}
@keyframes tween-color {
0% {
background-color: red;
}
50% {
background-color: green;
}
100% {
background-color: red;
}
}
html,
body {
height: 100%;
}
<style>
<body>
<div class="my-element"></div>
</body>CSS animation properties template:
{
animation-name: anima-name;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-delay: 2s;
animation-direction: reverse | normal | alternate | alternate-reverse ;
animation-timing-function: ease | ease-out | ease-in | ease-in-out | linear | cubic-bezier(x1, y1, x2, y2) (e.g. cubic-bezier(0.5, 0.2, 0.3, 1.0));
animation-fill-mode:forwards | backwards | both | none;
}
@keyframes anima-name {
from {
background-position:right;
}
to {
background-position:left;
}
}
@keyframes anima-name {
0% {
background-color: red;
}
50% {
background-color: green;
}
100% {
background-color: red;
}
}
<!DOCTYPE html>
<html>
<head>
<style>
div {
width: 100px;
height: 100px;
background-color: red;
position: relative;
animation: myfirst 5s linear 2s infinite alternate;
}
@keyframes myfirst {
0% {background-color:red; left:0px; top:0px;}
25% {background-color:yellow; left:200px; top:0px;}
50% {background-color:blue; left:200px; top:200px;}
75% {background-color:green; left:0px; top:200px;}
100% {background-color:red; left:0px; top:0px;}
}
</style>
</head>
<body>
<p><b>Note:</b> This example does not work in Internet Explorer 9 and earlier versions.</p>
<div><p>you can add text in this box or anithing else like a pictrue</p></div>
</body>
</html>Read this helpful, short and straightforward article to learn CSS animation perfectly.
https://medium.com/@Cafe_Code/learn-css-animation-asap-as-simple-as-possible-374b7874d4dd<style>
#ball {
width: 100px;
height: 100px;
margin: 50px auto;
position: relative;
border-radius: 50%;
background: linear-gradient(
35deg,
#ccffff,
#ffcccc
);
/*"Call" the animation "function" */
animation-name: bounce;
animation-duration: 1s;
animation-iteration-count: infinite;
animation-delay: 2s;
/* Normal, reverse, alternate(between the fwd and back)
and alternate-reverse */
animation-direction: reverse;
/* Ease is deafault, use cubic-bezier(n,n,n,n) for custom */
animation-timing-function: linear;
/* if you want something to display from hidden
set the opacity to 0 and in the keyframe steps bring
the opacity to 1 gradually to stop it flashing */
}
/* The animation "bounce" */
@keyframes bounce{
/* start */
0% {
top: 0px;
}
/* step (you can add multiple incremental steps from 1-100) */
50% {
top: 249px;
width: 130px;
height: 90px;
}
/* end (you can count down from 100 to 0 too) */
100% {
top: 0px;
}
}
</style>
<div id="ball"></div>animation: name duration timing-function delay iteration-count
direction fill-mode play-state;
Also in CSS:
- Title
- css disabled div
- Category
- CSS
- Title
- svg to css converter
- Category
- CSS
- Title
- css keep background image from scrolling
- Category
- CSS
- Title
- css change text size
- Category
- CSS
- Title
- css how to add double shadow to text
- Category
- CSS
- Title
- css hover
- Category
- CSS
- Title
- change the weight of a bold font css
- Category
- CSS
- Title
- css border
- Category
- CSS
- Title
- text animation css
- Category
- CSS
- Title
- To set HTML attribute and css styles in html helper control in mvc
- Category
- CSS
- Title
- css text line in middle
- Category
- CSS
- Title
- rel css
- Category
- CSS
- Title
- how to apply different properties to different paragraphs in css
- Category
- CSS
- Title
- disable scroll css
- Category
- CSS
- Title
- svg css
- Category
- CSS
- Title
- 3wscool
- Category
- CSS
- Title
- custom checkbox with image css
- Category
- CSS
- Title
- css calc height
- Category
- CSS
- Title
- remove default input style css
- Category
- CSS
- Title
- css last child with class
- Category
- CSS
- Title
- center div vertically html css
- Category
- CSS
- Title
- text underline hover css
- Category
- CSS
- Title
- Also define the standard property 'transition'
- Category
- CSS
- Title
- grayscale filter css
- Category
- CSS
- Title
- css not first child
- Category
- CSS
- Title
- css backdrop filter blut
- Category
- CSS
- Title
- nth child css
- Category
- CSS
- Title
- transparent background css
- Category
- CSS
- Title
- underline text css
- Category
- CSS
- Title
- pure css heart
- Category
- CSS
- Title
- nth-child() css
- Category
- CSS
- Title
- css underline color
- Category
- CSS
- Title
- css all children of type
- Category
- CSS
- Title
- css change font awesome icon color
- Category
- CSS
- Title
- css internal style
- Category
- CSS
- Title
- how to stick a text to a div in css
- Category
- CSS
- Title
- tradutt
- Category
- CSS
- Title
- text-decoration css
- Category
- CSS
- Title
- box shadow
- Category
- CSS
- Title
- breakpoint bootstrap
- Category
- CSS
- Title
- button width based on text csss
- Category
- CSS
- Title
- css sticky header with nav bar
- Category
- CSS
- Title
- texto com tamanho maximo ler mais html
- Category
- CSS
- Title
- css first h element
- Category
- CSS
- Title
- kotlin exit app
- Category
- CSS
- Title
- line height negative css
- Category
- CSS
- Title
- difference between class and id in html css
- Category
- CSS
- Title
- center vertically and horizontally css
- Category
- CSS
- Title
- how to fade out images html css
- Category
- CSS
- Title
- css border style
- Category
- CSS
- Title
- stop the client from scrolling
- Category
- CSS
- Title
- change color of css in js
- Category
- CSS
- Title
- absolute path and relative path
- Category
- CSS
- Title
- tint image css
- Category
- CSS
- Title
- social media icon bar html
- Category
- CSS
- Title
- DevTools failed to load SourceMap: Could not load content for bootstrap.min.css.map
- Category
- CSS
- Title
- css remove button outline
- Category
- CSS
- Title
- css paragraph ellipsis
- Category
- CSS
- Title
- add own image in cursor using css
- Category
- CSS
- Title
- react import css
- Category
- CSS
- Title
- orientation css max and min width media query
- Category
- CSS
- Title
- QAnon Won't believe who
- Category
- CSS
- Title
- touch scroll css gallery
- Category
- CSS
- Title
- hwo to use flexbox to make a nav bar
- Category
- CSS
- Title
- Scaling Images and Videos css
- Category
- CSS
- Title
- css remove border input focus
- Category
- CSS
- Title
- button href
- Category
- CSS
- Title
- css background color transition
- Category
- CSS
- Title
- css italic text
- Category
- CSS
- Title
- flex wrap css
- Category
- CSS
- Title
- css rotate animation
- Category
- CSS
- Title
- how to make a text in center with background color in css
- Category
- CSS
- Title
- a no line css
- Category
- CSS
- Title
- css grid vs flexbox
- Category
- CSS
- Title
- tab link class in html
- Category
- CSS
- Title
- center ul
- Category
- CSS
- Title
- vertical align css
- Category
- CSS
- Title
- how to apply a transition to a child element when hovering over parent element
- Category
- CSS
- Title
- style message d'erreur css
- Category
- CSS
- Title
- multiple transition in css
- Category
- CSS
- Title
- ramteja
- Category
- CSS
- Title
- Wrap the last word of a paragraph in span tags using jQuery
- Category
- CSS
- Title
- how to set favicon
- Category
- CSS
- Title
- laavel relation through morph
- Category
- CSS
- Title
- remove border select css
- Category
- CSS
- Title
- change border highlight color on an input text element
- Category
- CSS
- Title
- print zend db select query to string
- Category
- CSS
- Title
- css position
- Category
- CSS
- Title
- how to use direct child for ol in css
- Category
- CSS
- Title
- restrict a paragraph height css
- Category
- CSS
- Title
- remove underline from link css
- Category
- CSS
- Title
- difference between :after and ::after
- Category
- CSS
- Title
- css two attribute selector
- Category
- CSS
- Title
- adding shadow to a div
- Category
- CSS
- Title
- large input box bootstrap 4
- Category
- CSS
- Title
- materialize css for react
- Category
- CSS
- Title
- min height css
- Category
- CSS
- Title
- media types in css
- Category
- CSS
- Title
- image orientation css
- Category
- CSS
- Title
- smooth scroll css
- Category
- CSS