File tree Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Expand file tree Collapse file tree 2 files changed +36
-1
lines changed Original file line number Diff line number Diff line change @@ -9,7 +9,7 @@ and pairing with smart people at Hashrocket.
99
1010For a steady stream of TILs, [ sign up for my newsletter] ( https://tinyletter.com/jbranchaud ) .
1111
12- _ 877 TILs and counting..._
12+ _ 878 TILs and counting..._
1313
1414---
1515
@@ -97,6 +97,7 @@ _877 TILs and counting..._
9797- [ Apply Multiple Box Shadows To Single Element] ( css/apply-multiple-box-shadows-to-single-element.md )
9898- [ Apply Styles To The Last Child Of A Specific Type] ( css/apply-styles-to-the-last-child-of-a-specific-type.md )
9999- [ Circular Icons With A Massive Border Radius] ( css/circular-icons-with-a-massive-border-radius.md )
100+ - [ Create A Pulsing Background With CSS Animation] ( css/create-a-pulsing-background-with-css-animation.md )
100101- [ Dry Up SCSS With Mixins] ( css/dry-up-scss-with-mixins.md )
101102- [ Lighten And Darken With CSS Brightness Filter] ( css/lighten-and-darken-with-css-brightness-filter.md )
102103- [ Lighten And Darken With SCSS] ( css/lighten-and-darken-with-scss.md )
Original file line number Diff line number Diff line change 1+ # Create A Pulsing Background With CSS Animation
2+
3+ You can create a smoothly pulsing background effect with CSS animations. This
4+ can be achieved by defining a set of keyframes that start at one background
5+ color, transitions to another color, and then transitions back to the original
6+ color.
7+
8+ ``` css
9+ @keyframes pulse {
10+ 0% , 100% {
11+ background-color : #f56a3f ;
12+ }
13+ 50% {
14+ background-color : #9e42b0 ;
15+ }
16+ }
17+ ```
18+
19+ At the beginning (` 0% ` ) and end (` 100% ` ) we declare the background color to be
20+ ` #f56a3f ` . Halfway through (` 50% ` ) it should be ` #9e42b0 ` . The browser will
21+ animate everything in between.
22+
23+ This can then be applied infinitely with a lengthy duration to give it a real
24+ smooth feel.
25+
26+ ``` css
27+ body {
28+ animation : pulse 20s infinite ;
29+ }
30+ ```
31+
32+ Here is a [ live example] ( https://codepen.io/jbranchaud/pen/vYYqQjO ) .
33+
34+ [ source] ( https://css-tricks.com/almanac/properties/a/animation/ )
You can’t perform that action at this time.
0 commit comments