{"id":450,"date":"2025-10-15T01:36:00","date_gmt":"2025-10-14T22:36:00","guid":{"rendered":"https:\/\/html-online.com\/articles\/?p=450"},"modified":"2025-10-17T10:50:55","modified_gmt":"2025-10-17T07:50:55","slug":"html-css-keyframes-animated-head-drawing","status":"publish","type":"post","link":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/","title":{"rendered":"Animated Smiley Face With HTML And CSS"},"content":{"rendered":"<p>I have already presented how to <a href=\"\/articles\/html-css-drawing-star-wars-characters\/\">draw faces with plain HTML+CSS<\/a> and we&#8217;ve also learned about <a href=\"\/articles\/css3-cube\/\">CSS keyframes animation<\/a>. Let&#8217;s combine these two and create a continuously moving face with blinking eyes looking around and with a smiling mouth. Let&#8217;s do this using nothing but plain HTML5 CSS3!<\/p>\n<p><a href=\"https:\/\/html-css-js.com\/\" target=\"_blank\" rel=\"noopener noreferrer\"><img loading=\"lazy\" decoding=\"async\" width=\"600\" height=\"150\" class=\"aligncenter size-full wp-image-451\" src=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\" alt=\"drawing animated smiley css3 keyframes\" srcset=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg 600w, https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes-300x75.jpg 300w\" sizes=\"auto, (max-width: 709px) 85vw, (max-width: 909px) 67vw, (max-width: 984px) 61vw, (max-width: 1362px) 45vw, 600px\" \/><\/a><\/p>\n<p><!--more--><strong>Check out the live drawing at the <a href=\"https:\/\/html-css-js.com\/\" target=\"_blank\" rel=\"noopener noreferrer\">HTML CSS JavaScript home page<\/a> or edit the code at <a href=\"https:\/\/jsfiddle.net\/opj06hh9\/\" target=\"_blank\" rel=\"noopener noreferrer\">JSFiddle<\/a>.<\/strong><\/p>\n<p>We need to&nbsp;build the structure of the head first. We use a div for the head with a rounded black border and white background. This will wrap the two eyes with the eyelids and the pupils inside them. Finally we add the mouth. This will be an empty div with a border-bottom with rounded edges creating the illusion of a smiley mouth.<\/p>\n<h2>The HTML Code<\/h2>\n<p>Now we have the HTML skeleton of Bob (because that&#8217;s why I call him).<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">id<\/span>=<span style=\"color: #d80800;\">\"cssHead\"<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssEye leftEye\"<\/span>&gt;<\/span>\n        <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssEyeLid\"<\/span>&gt;<\/span>\n            <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssPupil\"<\/span>&gt;<\/span>\n            <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n        <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssEye rightEye\"<\/span>&gt;<\/span>\n        <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssEyeLid\"<\/span>&gt;<\/span>\n            <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssPupil\"<\/span>&gt;<\/span>                      \n            <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n        <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;<span style=\"font-weight: bold;\">div<\/span> <span style=\"font-style: italic;\">class<\/span>=<span style=\"color: #d80800;\">\"cssMouth\"<\/span>&gt;<\/span>\n    <span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>          \n<span style=\"color: #1c02ff;\">&lt;\/<span style=\"font-weight: bold;\">div<\/span>&gt;<\/span>\n<\/pre>\n<h2>Styling the divs to look like a head<\/h2>\n<p>For those who are experienced with CSS styling this shouldn&#8217;t be a big deal. You might want to come up with your own designs. Here&#8217;s how I styled Bob:<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"font-style: italic;\">#cssHead<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">width<\/span>: <span style=\"color: #cd0000; font-style: italic;\">180<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">background-color<\/span>: <span style=\"color: #c5060b; font-style: italic;\">#fff<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">180<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">500<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">500<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border<\/span>: <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    -moz-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);\n    -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);\n    -o-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);\n    -ms-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);\n    transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);\n}\n<span style=\"font-style: italic;\">.cssEye<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">display<\/span>: <span style=\"color: #06960e; font-weight: bold;\">inline-block<\/span>;\n}\n<span style=\"font-style: italic;\">.cssPupil<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">width<\/span>: <span style=\"color: #cd0000; font-style: italic;\">12<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">background<\/span>: <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">12<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n}\n<span style=\"font-style: italic;\">.cssEyeLid<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">border<\/span>: <span style=\"color: #cd0000; font-style: italic;\">1<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">overflow<\/span>: <span style=\"color: #06960e; font-weight: bold;\">hidden<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;\n}\n<span style=\"font-style: italic;\">.htmlEye<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">border<\/span>: <span style=\"color: #cd0000; font-style: italic;\">1<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">display<\/span>: <span style=\"color: #06960e; font-weight: bold;\">inline-block<\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n}\n<span style=\"font-style: italic;\">.wraphtmlEye<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">background-color<\/span>: <span style=\"color: #c5060b; font-style: italic;\">#DDD<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">padding<\/span>: <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">width<\/span>: <span style=\"color: #cd0000; font-style: italic;\">25<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">25<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n}\n<span style=\"font-style: italic;\">.htmlPupil<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">width<\/span>: <span style=\"color: #cd0000; font-style: italic;\">12<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">background<\/span>: <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">12<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n}\n<span style=\"font-style: italic;\">.rightEye<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;\n}\n<span style=\"font-style: italic;\">.leftEye<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">50<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">66<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n}\n<span style=\"font-style: italic;\">.cssMouth<\/span> {\n    <span style=\"color: #6d79de; font-weight: bold;\">border-top<\/span>: <span style=\"color: #06960e; font-weight: bold;\">none<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-right<\/span>: <span style=\"color: #06960e; font-weight: bold;\">none<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-left<\/span>: <span style=\"color: #06960e; font-weight: bold;\">none<\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;\n    -webkit-<span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">100<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">border-radius<\/span>: <span style=\"color: #cd0000; font-style: italic;\">100<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">width<\/span>: <span style=\"color: #cd0000; font-style: italic;\">45<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;\n    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;\n}\n<\/pre>\n<p>I think there&#8217;s nothing much to be explained about the code. Not a big deal, just some borders around positioned divs.<\/p>\n<h2>CSS3 Animation Using Keyframes<\/h2>\n<p>The styles above won&#8217;t make Bob move, we have to set up the animations too. I&#8217;m setting up&nbsp;cyclically repeating movements for&nbsp;wiggleing the head, moving the pupils, blinking and moving the mouth. I set various cycle durations for each effect to avoid the illusion of repetition.<\/p>\n<h3>Animating The Head<\/h3>\n<p>I set a 10 seconds cycle and during this Bob&#8217;s head, the div element wrapping the whe eyes and the mouth goes through several rotations.<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"color: #00b418;\">\/*CSS head animation BEGIN*\/<\/span>\n<span style=\"font-style: italic;\">#cssHead<\/span> {\n    -webkit-animation: headRotations <span style=\"color: #cd0000; font-style: italic;\">10<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n    animation: headRotations <span style=\"color: #cd0000; font-style: italic;\">10<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n}\n@-webkit-keyframes headRotations {\n    0% {    -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    20% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    25% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-4<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    28% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    40% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    50% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    60% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    70% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    90% {   -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    100% {  -webkit-transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n}\n@keyframes headRotations {\n    0% {    transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    20% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    25% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-4<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    28% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    40% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    50% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    60% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n    70% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    90% {   transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);     }\n    100% {  transform: rotate(<span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>) skew(<span style=\"color: #cd0000; font-style: italic;\">-3<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>, <span style=\"color: #cd0000; font-style: italic;\">-2<span style=\"color: #0100b6; font-weight: bold;\">deg<\/span><\/span>);    }\n}\n<span style=\"color: #00b418;\">\/*CSS head animation END*\/<\/span>\n<\/pre>\n<h3>Eye Animation<\/h3>\n<p>The eye has a blinking effect and it&#8217;s continuously looking around. To create the illusion of exploring around I&#8217;m moving the two pupils together to avoid&nbsp;squinting.<\/p>\n<p>The blinking effect is made with reducing the height of the eyelids to 0. The eyelid is the div containging the pupils.<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"color: #00b418;\">\/*CSS pupils animation BEGIN*\/<\/span>\n<span style=\"font-style: italic;\">.cssPupil<\/span> {\n    -webkit-animation: lookingAround <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n    animation: lookingAround <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n}\n@-webkit-keyframes lookingAround {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    10% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    12% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    27% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    30% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    40% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    43% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">1<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    46% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    57% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    60% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    63% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    77% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    80% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    85% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    88% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    92% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n}\n@keyframes lookingAround {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    10% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    12% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    27% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    30% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    40% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    43% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">1<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    46% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    57% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    60% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    63% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    77% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    80% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    85% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">4<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    88% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    92% {   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    }\n}\n<span style=\"color: #00b418;\">\/*CSS pupils animation END*\/<\/span>\n<span style=\"color: #00b418;\">\/*CSS blinking BEGIN*\/<\/span>\n<span style=\"font-style: italic;\">.cssEyeLid<\/span> {\n    -webkit-animation: blinkingEye <span style=\"color: #cd0000; font-style: italic;\">7<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n    animation: blinkingEye <span style=\"color: #cd0000; font-style: italic;\">7<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n}\n@-webkit-keyframes blinkingEye {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    58% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    60% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>; }\n    66% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n}\n@keyframes blinkingEye {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    58% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    60% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;    <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>; }\n    66% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;  }\n}\n<span style=\"color: #00b418;\">\/*CSS blinking END*\/<\/span>\n<\/pre>\n<h3>The Mouth<\/h3>\n<p>Our CSS drawing character needs a mouth to smile. The effect is created by reducing the border-bottom of the mouth div to a smaller size then reducing it to the initial measure and position<\/p>\n<pre style=\"background: #fff; color: #000;\"><span style=\"color: #00b418;\">\/*CSS smiling animation BEGIN*\/<\/span>\n<span style=\"font-style: italic;\">.cssMouth<\/span> {\n    -webkit-animation: smilingMouth <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n    animation: smilingMouth <span style=\"color: #cd0000; font-style: italic;\">8<span style=\"color: #0100b6; font-weight: bold;\">s<\/span><\/span> infinite;\n}\n@-webkit-keyframes smilingMouth {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;     }\n    20% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">35<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">-10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;   }\n    80% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">35<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">-10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;   }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;     }\n}\n@keyframes smilingMouth {\n    0% {    <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;     }\n    20% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">35<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">-10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;   }\n    80% {   <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">35<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">6<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">-10<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;   }\n    100% {  <span style=\"color: #6d79de; font-weight: bold;\">height<\/span>: <span style=\"color: #cd0000; font-style: italic;\">20<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span>;   <span style=\"color: #6d79de; font-weight: bold;\">border-bottom<\/span>: <span style=\"color: #cd0000; font-style: italic;\">3<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">solid<\/span> <span style=\"color: #c5060b; font-style: italic;\">#000<\/span>;  <span style=\"color: #6d79de; font-weight: bold;\">margin<\/span>: <span style=\"color: #cd0000; font-style: italic;\">0<span style=\"color: #0100b6; font-weight: bold;\">px<\/span><\/span> <span style=\"color: #06960e; font-weight: bold;\">auto<\/span> <span style=\"color: #cd0000; font-style: italic;\">0<\/span>;     }\n}\n<span style=\"color: #00b418;\">\/*CSS smiling animation END*\/<\/span>\n<\/pre>\n<p>Note that in each animation cycle the last frame (100%) comes back to the initial state (0%) to avoid jumping.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>I have already presented how to draw faces with plain HTML+CSS and we&#8217;ve also learned about CSS keyframes animation. Let&#8217;s combine these two and create a continuously moving face with blinking eyes looking around and with a smiling mouth. Let&#8217;s do this using nothing but plain HTML5 CSS3!<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1,2,3,4],"tags":[],"class_list":["post-450","post","type-post","status-publish","format-standard","hentry","category-articles","category-css","category-freebies","category-html"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v26.7 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Animated Smiley Face With HTML And CSS Keyframes<\/title>\n<meta name=\"description\" content=\"how to draw faces with plain HTML+CSS and we&#039;ve also learned about CSS keyframes animation. Let&#039;s combine these two and create a moving face\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Animated Smiley Face With HTML And CSS Keyframes\" \/>\n<meta property=\"og:description\" content=\"how to draw faces with plain HTML+CSS and we&#039;ve also learned about CSS keyframes animation. Let&#039;s combine these two and create a moving face\" \/>\n<meta property=\"og:url\" content=\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\" \/>\n<meta property=\"og:site_name\" content=\"HTML Online\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/htmlcoding\/\" \/>\n<meta property=\"article:published_time\" content=\"2025-10-14T22:36:00+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2025-10-17T07:50:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"600\" \/>\n\t<meta property=\"og:image:height\" content=\"150\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"HTML Editor\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"HTML Editor\" \/>\n\t<meta name=\"twitter:label2\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"6 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#article\",\"isPartOf\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\"},\"author\":{\"name\":\"HTML Editor\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d\"},\"headline\":\"Animated Smiley Face With HTML And CSS\",\"datePublished\":\"2025-10-14T22:36:00+00:00\",\"dateModified\":\"2025-10-17T07:50:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\"},\"wordCount\":410,\"publisher\":{\"@id\":\"https:\/\/html-online.com\/articles\/#organization\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\",\"articleSection\":[\"Articles\",\"CSS\",\"Freebies\",\"HTML\"],\"inLanguage\":\"en-GB\"},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\",\"url\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\",\"name\":\"Animated Smiley Face With HTML And CSS Keyframes\",\"isPartOf\":{\"@id\":\"https:\/\/html-online.com\/articles\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage\"},\"thumbnailUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\",\"datePublished\":\"2025-10-14T22:36:00+00:00\",\"dateModified\":\"2025-10-17T07:50:55+00:00\",\"description\":\"how to draw faces with plain HTML+CSS and we've also learned about CSS keyframes animation. Let's combine these two and create a moving face\",\"breadcrumb\":{\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage\",\"url\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\",\"contentUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg\",\"width\":600,\"height\":150,\"caption\":\"drawing animated smiley css3 keyframes\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\/\/html-online.com\/articles\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Animated Smiley Face With HTML And CSS\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/html-online.com\/articles\/#website\",\"url\":\"https:\/\/html-online.com\/articles\/\",\"name\":\"HTML Online Articles\",\"description\":\"Tips, tricks, tutorials\u2026\",\"publisher\":{\"@id\":\"https:\/\/html-online.com\/articles\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/html-online.com\/articles\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/html-online.com\/articles\/#organization\",\"name\":\"HTML Online\",\"url\":\"https:\/\/html-online.com\/articles\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg\",\"contentUrl\":\"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg\",\"width\":350,\"height\":350,\"caption\":\"HTML Online\"},\"image\":{\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/\"},\"sameAs\":[\"https:\/\/www.facebook.com\/htmlcoding\/\",\"https:\/\/www.linkedin.com\/in\/ferencdenes\/\",\"https:\/\/www.youtube.com\/channel\/UCn38Jw1sJzbjVHO95Zp0Sww\"]},{\"@type\":\"Person\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d\",\"name\":\"HTML Editor\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/html-online.com\/articles\/#\/schema\/person\/image\/\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g\",\"caption\":\"HTML Editor\"},\"description\":\"In 2013, while wrestling with a mountain of client articles and an uncooperative CMS, I decided enough was enough. So, I created an online HTML editor purely out of necessity (and mild frustration). What began as a tool for my own sanity quickly evolved into a gift for the world\u2014or at least for anyone trying to avoid breaking their website's code. Since then, I've shared my tech notes on my blog, which serves as both a handy reference and a digital diary of the adventures and misadventures of a coder.\",\"sameAs\":[\"https:\/\/www.linkedin.com\/in\/ferencdenes\/\",\"https:\/\/www.youtube.com\/@htmlg\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Animated Smiley Face With HTML And CSS Keyframes","description":"how to draw faces with plain HTML+CSS and we've also learned about CSS keyframes animation. Let's combine these two and create a moving face","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/","og_locale":"en_GB","og_type":"article","og_title":"Animated Smiley Face With HTML And CSS Keyframes","og_description":"how to draw faces with plain HTML+CSS and we've also learned about CSS keyframes animation. Let's combine these two and create a moving face","og_url":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/","og_site_name":"HTML Online","article_publisher":"https:\/\/www.facebook.com\/htmlcoding\/","article_published_time":"2025-10-14T22:36:00+00:00","article_modified_time":"2025-10-17T07:50:55+00:00","og_image":[{"width":600,"height":150,"url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg","type":"image\/jpeg"}],"author":"HTML Editor","twitter_card":"summary_large_image","twitter_misc":{"Written by":"HTML Editor","Estimated reading time":"6 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#article","isPartOf":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/"},"author":{"name":"HTML Editor","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d"},"headline":"Animated Smiley Face With HTML And CSS","datePublished":"2025-10-14T22:36:00+00:00","dateModified":"2025-10-17T07:50:55+00:00","mainEntityOfPage":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/"},"wordCount":410,"publisher":{"@id":"https:\/\/html-online.com\/articles\/#organization"},"image":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage"},"thumbnailUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg","articleSection":["Articles","CSS","Freebies","HTML"],"inLanguage":"en-GB"},{"@type":"WebPage","@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/","url":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/","name":"Animated Smiley Face With HTML And CSS Keyframes","isPartOf":{"@id":"https:\/\/html-online.com\/articles\/#website"},"primaryImageOfPage":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage"},"image":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage"},"thumbnailUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg","datePublished":"2025-10-14T22:36:00+00:00","dateModified":"2025-10-17T07:50:55+00:00","description":"how to draw faces with plain HTML+CSS and we've also learned about CSS keyframes animation. Let's combine these two and create a moving face","breadcrumb":{"@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/"]}]},{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#primaryimage","url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg","contentUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2017\/11\/animated-smiley-face-css3-keyframes.jpg","width":600,"height":150,"caption":"drawing animated smiley css3 keyframes"},{"@type":"BreadcrumbList","@id":"https:\/\/html-online.com\/articles\/html-css-keyframes-animated-head-drawing\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/html-online.com\/articles\/"},{"@type":"ListItem","position":2,"name":"Animated Smiley Face With HTML And CSS"}]},{"@type":"WebSite","@id":"https:\/\/html-online.com\/articles\/#website","url":"https:\/\/html-online.com\/articles\/","name":"HTML Online Articles","description":"Tips, tricks, tutorials\u2026","publisher":{"@id":"https:\/\/html-online.com\/articles\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/html-online.com\/articles\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/html-online.com\/articles\/#organization","name":"HTML Online","url":"https:\/\/html-online.com\/articles\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/","url":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg","contentUrl":"https:\/\/html-online.com\/articles\/wp-content\/uploads\/2022\/06\/logo.jpg","width":350,"height":350,"caption":"HTML Online"},"image":{"@id":"https:\/\/html-online.com\/articles\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/htmlcoding\/","https:\/\/www.linkedin.com\/in\/ferencdenes\/","https:\/\/www.youtube.com\/channel\/UCn38Jw1sJzbjVHO95Zp0Sww"]},{"@type":"Person","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/019f9afa07f209153df0fecfc90b8c1d","name":"HTML Editor","image":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/html-online.com\/articles\/#\/schema\/person\/image\/","url":"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/7c1d8f5e7f1dc3e261766a96ac50c6a907fa5c236e87ab73379c57c9114e92cd?s=96&d=mm&r=g","caption":"HTML Editor"},"description":"In 2013, while wrestling with a mountain of client articles and an uncooperative CMS, I decided enough was enough. So, I created an online HTML editor purely out of necessity (and mild frustration). What began as a tool for my own sanity quickly evolved into a gift for the world\u2014or at least for anyone trying to avoid breaking their website's code. Since then, I've shared my tech notes on my blog, which serves as both a handy reference and a digital diary of the adventures and misadventures of a coder.","sameAs":["https:\/\/www.linkedin.com\/in\/ferencdenes\/","https:\/\/www.youtube.com\/@htmlg"]}]}},"_links":{"self":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/450","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/comments?post=450"}],"version-history":[{"count":4,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/450\/revisions"}],"predecessor-version":[{"id":1193,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/posts\/450\/revisions\/1193"}],"wp:attachment":[{"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/media?parent=450"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/categories?post=450"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/html-online.com\/articles\/wp-json\/wp\/v2\/tags?post=450"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}