Animations and pseudo-elements

Developer
Size
3,637 Kb
Views
14,168

How do I make an animations and pseudo-elements?

This is a tiny demo showing the subtle animation effects you can apply to :after or :before psuedo-elements. With just a little bit of tasteful CSS (and a touch of JavaScript), you can create some really fun interactions while still maintaining clean HTML.. What is a animations and pseudo-elements? How do you make a animations and pseudo-elements? This script and codes were developed by Neil Renicker on 24 November 2022, Thursday.

Animations and pseudo-elements Previews

Animations and pseudo-elements - Script Codes HTML Codes

<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Animations and pseudo-elements</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="box"> <p class="box-message" data-dead-message="Oh noes!">Welcome, Earthling.</p>
</div>
<div class="robot"> <img src="https://f.cl.ly/items/2D2M3f0a3W2Z2E0P3G1D/robot.png" alt="Robot" />
</div>
<!-- amazingly cute robot icon courtesy Aha-Soft, via iconfinder.com
https://www.iconfinder.com/icons/131463/ --> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>

Animations and pseudo-elements - Script Codes CSS Codes

body { background-color: #a2dc75; font-family: Verdana, sans-serif;
}
.box { -moz-transition: all 0.15s ease-in-out; -o-transition: all 0.15s ease-in-out; -webkit-transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out; background-color: #fff; color: #3a3a3a; font-size: 14px; letter-spacing: 1px; margin: 10em auto 3em; max-width: 15em; padding: 1em; position: relative; cursor: pointer; text-align: center; text-transform: uppercase;
}
.box:after { -moz-transition: all 0.15s ease-in-out; -o-transition: all 0.15s ease-in-out; -webkit-transition: all 0.15s ease-in-out; transition: all 0.15s ease-in-out; content: ""; border: solid transparent; border-top-color: #fff; height: 0; width: 0; left: 50%; position: absolute; pointer-events: none; border-width: 20px; margin-left: -20px; bottom: -2.2em;
}
.box:hover { background-color: #f4fbef; margin: 10.15em auto 2.85em;
}
.box:hover:after { bottom: -2.65em; border-top-color: #f4fbef;
}
.robot { -moz-border-radius: 50%; -webkit-border-radius: 50%; border-radius: 50%; position: relative; height: 5.8em; width: 9.2em; overflow: hidden; margin: 0 auto;
}
.robot:after { -moz-border-radius: 50%; -webkit-border-radius: 50%; border-radius: 50%; -moz-transition: all 0.1s ease-in-out; -o-transition: all 0.1s ease-in-out; -webkit-transition: all 0.1s ease-in-out; transition: all 0.1s ease-in-out; display: block; content: ""; width: 4.5em; height: 1.5em; position: absolute; background-color: #79cd38; left: 50%; margin-left: -2.25em; top: 4em; z-index: -1;
}
.robot img { -moz-transition: all 0.3s ease-in-out; -o-transition: all 0.3s ease-in-out; -webkit-transition: all 0.3s ease-in-out; transition: all 0.3s ease-in-out; display: block; margin: 0 auto; max-width: 5em; position: relative; z-index: 1;
}
.robot_is-dead img { margin-top: 6em;
}
.robot_is-dead:after { background-color: #000; width: 6em; height: 1.75em; margin-left: -3em;
}

Animations and pseudo-elements - Script Codes JS Codes

(function() { var $boxTrigger, $message, $robot, aliveMessage, deadMessage; $boxTrigger = $(".box"); $robot = $(".robot"); $message = $(".box-message"); aliveMessage = $message.text(); deadMessage = $message.data("dead-message"); $boxTrigger.click(function() { $robot.toggleClass("robot_is-dead"); if ($robot.hasClass("robot_is-dead")) { return $message.text(deadMessage); } else { return $message.text(aliveMessage); } });
}).call(this);
Animations and pseudo-elements - Script Codes
Animations and pseudo-elements - Script Codes
Home Page Home
Developer Neil Renicker
Username tinystride
Uploaded November 24, 2022
Rating 3.5
Size 3,637 Kb
Views 14,168
Do you need developer help for Animations and pseudo-elements?

Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!

Neil Renicker (tinystride) Script Codes
Create amazing web content with AI!

Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!