The HTML and CSS Workshop by Lewis Coulson Brett Jephson Rob Larsen Matt Park and Marian Zburlea
Author:Lewis Coulson, Brett Jephson, Rob Larsen, Matt Park,
and Marian Zburlea
Language: eng
Format: epub
Publisher: Packt Publishing Pvt. Ltd.
Published: 2020-12-29T00:00:00+00:00
CSS Transitions
CSS transitions are used throughout the modern web and, in short, they enable CSS properties to change values, thus creating a simple animation. CSS transitions are the basic fundamentals of CSS animations and are the basis of creating more advanced animations. However, transitions in themselves can create a whole world of effects. A common example of a CSS transition would be that the change in the color of an element on hover but rather than the color changes snapping straight away, they would have a more subtle transition from color 1 to color 2 over 250 or 500 milliseconds, instead of an instant change.
To demonstrate a very simple example with a color change, take a look at the following code snippet, which you can copy and paste into any of your HTML files, or into a new one, to see it in action:
<style>
p {
transition: 250ms;
}
p:hover {
background-color: darkolivegreen;
color: white;
}
</style>
<p>This is a very simple example of a transition</p>
The preceding code snippet will change the p element on its hover state to have a background color of 'darkolivegreen' (from the default of white) and a text color of 'white' (from the default of black). The code says that the change in colors should take 250 milliseconds.
A transition in CSS will describe how a property of a given CSS selector should display the change when given a different value. The transition-duration property specifies how many seconds (s) or milliseconds (ms) a transition effect takes to complete.
A transition will require a minimum of one value, that is, the duration of the animation, which is a numeric value. In our example, we used the most common unit, which is s for seconds.
The following screenshot shows the transition-duration property with a value of 0.2 seconds:
Download
This site does not store any files on its server. We only index and link to content provided by other sites. Please contact the content providers to delete copyright contents if any and email us, we'll remove relevant links or contents immediately.
Ajax | Assembly Language Programming |
Borland Delphi | C & C++ |
C# | CSS |
Compiler Design | Compilers |
DHTML | Debugging |
Delphi | Fortran |
Java | Lisp |
Perl | Prolog |
Python | RPG |
Ruby | Swift |
Visual Basic | XHTML |
XML | XSL |
Deep Learning with Python by François Chollet(12571)
Hello! Python by Anthony Briggs(9916)
OCA Java SE 8 Programmer I Certification Guide by Mala Gupta(9796)
The Mikado Method by Ola Ellnestam Daniel Brolund(9779)
Dependency Injection in .NET by Mark Seemann(9340)
Algorithms of the Intelligent Web by Haralambos Marmanis;Dmitry Babenko(8300)
Test-Driven iOS Development with Swift 4 by Dominik Hauser(7763)
Grails in Action by Glen Smith Peter Ledbrook(7696)
The Well-Grounded Java Developer by Benjamin J. Evans Martijn Verburg(7557)
Becoming a Dynamics 365 Finance and Supply Chain Solution Architect by Brent Dawson(7084)
Microservices with Go by Alexander Shuiskov(6854)
Practical Design Patterns for Java Developers by Miroslav Wengner(6772)
Test Automation Engineering Handbook by Manikandan Sambamurthy(6713)
Secrets of the JavaScript Ninja by John Resig Bear Bibeault(6419)
Angular Projects - Third Edition by Aristeidis Bampakos(6118)
The Art of Crafting User Stories by The Art of Crafting User Stories(5648)
NetSuite for Consultants - Second Edition by Peter Ries(5580)
Demystifying Cryptography with OpenSSL 3.0 by Alexei Khlebnikov(5385)
Kotlin in Action by Dmitry Jemerov(5065)
