<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Brittan McGinnis</title>
    <description>The latest articles on DEV Community by Brittan McGinnis (@brittanmcg).</description>
    <link>https://dev.to/brittanmcg</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F63516%2F873210d4-2eda-4dc9-8bce-550787de98dc.jpg</url>
      <title>DEV Community: Brittan McGinnis</title>
      <link>https://dev.to/brittanmcg</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/brittanmcg"/>
    <language>en</language>
    <item>
      <title>How To Use the CSS Transform Property</title>
      <dc:creator>Brittan McGinnis</dc:creator>
      <pubDate>Tue, 08 May 2018 11:44:17 +0000</pubDate>
      <link>https://dev.to/brittanmcg/how-to-use-the-css-transform-property-g0a</link>
      <guid>https://dev.to/brittanmcg/how-to-use-the-css-transform-property-g0a</guid>
      <description>

&lt;h1&gt;
  
  
  How To Use the CSS Transform Property
&lt;/h1&gt;

&lt;p&gt;I’m setting out to learn CSS animations and the &lt;code&gt;transform&lt;/code&gt; property was the second piece on my list. &lt;br&gt;
My goal of this post is to teach (so that I can better learn), the very basics of &lt;code&gt;transform&lt;/code&gt;.&lt;br&gt;
This property is super cool and was actually pretty fun to learn. I would suggest playing around with it if you are not familiar. &lt;/p&gt;

&lt;h3&gt;
  
  
  Basics
&lt;/h3&gt;

&lt;p&gt;You should have a basic understanding of CSS and HTML prior to reading this article.&lt;/p&gt;

&lt;h2&gt;
  
  
  Introduction
&lt;/h2&gt;

&lt;p&gt;This journey that I’m on to learn CSS animations has a super important learning element to it. I basically find and filter information pertaining to this concept. Make a list of learning comprehensions that need to be understood before I can say I “know” the thing. Do those things, be it reading articles, doing exercises, watching videos, reading books, etc. one by one. Then I play around. I have no set goal when doing this. Just to play in the most basic sense. Break stuff. Have fun. Mostly this step is to develop questions. Then research and answer my questions. Then teach. That could be a blog post, teaching a friend or just explaining in depth the concept.&lt;/p&gt;

&lt;p&gt;During this post I may gloss over some other concepts. This post is mainly just for the CSS &lt;code&gt;transform&lt;/code&gt; property. However, I will be using the &lt;code&gt;transition&lt;/code&gt; property quite a bit as well. If you would like to read further on that, I have another blog post for &lt;a href="https://dev.to/brittanmcg/how-to-use-the-css-transition-property-20mm"&gt;that&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  Transforms
&lt;/h3&gt;

&lt;p&gt;CSS &lt;code&gt;transform&lt;/code&gt; has 6 main property values:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;scale&lt;/li&gt;
&lt;li&gt;translate&lt;/li&gt;
&lt;li&gt;rotate&lt;/li&gt;
&lt;li&gt;skew&lt;/li&gt;
&lt;li&gt;perspective&lt;/li&gt;
&lt;li&gt;matrix&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;In truth it has way more, because many of those values have an X, Y and Z property. For the sake of brevity though, I will not display that entire list. If you would like to take a look, you can see it [here].&lt;/p&gt;

&lt;p&gt;I’ll explain below what each one of the values does.&lt;/p&gt;

&lt;h2&gt;
  
  
  Lets play with these
&lt;/h2&gt;

&lt;p&gt;Below, I’ll build 7 examples cards. Each will perform the animation that it’s named. &lt;/p&gt;

&lt;h2&gt;
  
  
  Starter Code
&lt;/h2&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
  &amp;lt;div class="translate"&amp;gt;
    &amp;lt;p&amp;gt;translate&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;  
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;@import url(https://fonts.googleapis.com/css?family=Open+Sans);

body {
  background: lightblue;
  font-family: 'Open Sans';
}

.translate {
  margin: 50px auto;
  background: papayawhip;
  width: 150px;
  height: 150px;
  border-radius: 20px;
}

p {
  margin-top: 60px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Adds hover psuedo class
&lt;/h3&gt;

&lt;p&gt;This moves the element down the Y axix 100px. While kinda cool and useful depending on your use case, it is not very graceful and does not animate very nicely. Next we'll add a &lt;code&gt;transition&lt;/code&gt; to make this animate smoothly.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...

.translate:hover {
  transform: translateY(100px);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...

.translate {
  // ...
  transition: 1s ease;
}

.translate:hover {
  transform: translateY(100px);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Scale
&lt;/h3&gt;

&lt;p&gt;Add a duplicate of the previous div and name the class to the property that we will be changing. &lt;br&gt;
I will not include this code for the following examples as it is the same.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;div class="container"&amp;gt;
  &amp;lt;div class="translate"&amp;gt;
    &amp;lt;p&amp;gt;translate&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;  
  &amp;lt;div class="scale"&amp;gt;
    &amp;lt;p&amp;gt;scale&amp;lt;/p&amp;gt;
  &amp;lt;/div&amp;gt;  
&amp;lt;/div&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Here we'll add a &lt;code&gt;text-align&lt;/code&gt; &lt;code&gt;center&lt;/code&gt; to the &lt;code&gt;.container&lt;/code&gt; so the elements will be in the center of this container.&lt;br&gt;
Then we'll change the &lt;code&gt;margin&lt;/code&gt; and &lt;code&gt;display&lt;/code&gt; properties so they sit next to each other.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.container {
  text-align: center;
}

.translate, .scale {
  margin: 50px 10px auto;
  display: inline-block;
  background: papayawhip;
  width: 150px;
  height: 150px;
  border-radius: 20px;
  transition: 1s ease;
}

p {
  margin-top: 60px;
}

// ...
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then we'll add a &lt;code&gt;scale&lt;/code&gt; property on hover. This will shrink it to 1/2 of it's original size. Because I only provide one value it uses that value for both the x and y coordinates. &lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.scale:hover {
  transform: scale(.5);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;If I provide it a second value then it will apply the value to the x and y coordinates respectively.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.scale:hover {
  transform: scale(.5, 2);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Rotate
&lt;/h3&gt;

&lt;p&gt;After you have duplicated the html and renamed the class and inner text for the p tag to rotate, then add the rotate class to our base styling for our divs like so:&lt;br&gt;
&lt;code&gt;.translate, .scale, .rotate {&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Then we'll add an &lt;code&gt;:active&lt;/code&gt; psuedo class to the &lt;code&gt;.rotate&lt;/code&gt; class. This way when we click on that element it rotates.&lt;br&gt;
The &lt;code&gt;rotate&lt;/code&gt; value takes a turn value or a degree value.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;rotate&lt;/code&gt; takes a negative or positive value. If you were to give this &lt;code&gt;transform: rotate(-360deg)&lt;/code&gt; for example it would turn counter-clockwise&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...

.rotate:active {
  transform: rotate(360deg);
}

// This accomplishes the same thing as above
.rotate:active {
  transform: rotate(1turn);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Skew
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;skew&lt;/code&gt; value will 'tilt' the element to one side depending on the value given. As with many of these functions you can specify either &lt;code&gt;scaleX&lt;/code&gt;, &lt;code&gt;scaleY&lt;/code&gt; or &lt;code&gt;scale&lt;/code&gt;. If you pass in only one value to &lt;code&gt;scale()&lt;/code&gt; it will give the Y axis a 0 value which will then only scale the X axis. &lt;/p&gt;

&lt;p&gt;The &lt;code&gt;skew&lt;/code&gt; value also takes degree values, turns or radius as parameters. This signature looks like this: &lt;code&gt;skew(10deg)&lt;/code&gt; or &lt;code&gt;skew(-0.06turn, 18deg)&lt;/code&gt; or &lt;code&gt;skew(.312rad)&lt;/code&gt;. Taken from the &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/transform-function/skew"&gt;MDN docs&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;Skew can be a little tricky because you may only want to skew the container of an element and not the inner content. In that case you will have to skew in reverse.&lt;/p&gt;

&lt;p&gt;Below you can see an example of skewing the div but keeping the text inside un-skewed.&lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;We'll duplicate our html, change our class name and our inner text like so &lt;code&gt;&amp;lt;p&amp;gt;skew&amp;lt;/p&amp;gt;&lt;/code&gt;
&lt;/li&gt;
&lt;li&gt;We'll add &lt;code&gt;.skew&lt;/code&gt; to our growing list of elements targeted in our base CSS&lt;/li&gt;
&lt;/ol&gt;

&lt;p&gt;Now we'll add a skew value to this element.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...

.skew:hover {
   transform: skew(10deg)
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Problem with this is that it skews the inner text as well. We can remedy that by giving it an inverse value of the same amount and targeting that element.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;.skew:hover p {
  transform: skew(-10deg);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;This is still kind of weird looking because the text corrects itself on hover. I'm not sure if there is a more natural way to fix this. I couldn't come up with one in this contrived example. If any reader has a better way please let me know in the comments.&lt;/p&gt;

&lt;h3&gt;
  
  
  Perspective
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;perspective&lt;/code&gt; value is used to give some perspective to 3d elements. You are targeting the z-index so that it looks as thought the element is popping out of the page. The point that the perspective originates from is the center. You can alter this using the &lt;code&gt;perspective-origin&lt;/code&gt; value. I will however use the &lt;code&gt;transform-origin&lt;/code&gt; property because I am using this on the transform property and on the perspective property.&lt;/p&gt;

&lt;p&gt;For this example I will use both the &lt;code&gt;perspective&lt;/code&gt; and the &lt;code&gt;transform-origin&lt;/code&gt; values. I'll make it look as though the card is flipping up and out from the bottom. &lt;/p&gt;

&lt;p&gt;Copy the code from the last example and add the respective class and supporting css.&lt;/p&gt;

&lt;p&gt;Then add this to the hover state.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.perspective {
  transform-origin: top;
}

.perspective:hover {
  transform: perspective(300px) rotateX(50deg);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;h3&gt;
  
  
  Matrix
&lt;/h3&gt;

&lt;p&gt;The &lt;code&gt;matrix&lt;/code&gt; function is a little more complex and admittedly the one that I spent the least amount of time playing with. Also it requires that you have a pretty good understanding of linear algebra and the Cartesian coordinates system (which I do not), in order to really understand what is going on.&lt;/p&gt;

&lt;p&gt;There is both a &lt;code&gt;matrix&lt;/code&gt; and a &lt;code&gt;matrix3d&lt;/code&gt; function. The &lt;code&gt;matrix&lt;/code&gt; function is behind every transform function. For example, when you are calling &lt;code&gt;rotateX(30deg)&lt;/code&gt;, you are actually saying &lt;code&gt;matrix(0.86602540, 0.50000000, -0.50000000, 0.86602540, 0, 0);&lt;/code&gt;. There is a cool matrix calculator for &lt;code&gt;rotate&lt;/code&gt; &lt;a href="http://www.boogdesign.com/examples/transforms/matrix-calculator.html"&gt;here&lt;/a&gt;, where you can see the value of your rotation. &lt;/p&gt;

&lt;p&gt;2d transforms are a 3x3 matrix of integers where 3d transforms are a 4x4 matrix. Hence the arguments passed to each function respectively.&lt;/p&gt;

&lt;p&gt;Big thanks to this deep dive article &lt;a href="https://dev.opera.com/articles/understanding-the-css-transforms-matrix/"&gt;Understanding the CSS Transforms Matrix&lt;/a&gt; by &lt;a href="https://twitter.com/webinista"&gt;Tiffany Brown&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Here I'll make this card flip up and out to the left using the &lt;code&gt;matrix&lt;/code&gt; function.&lt;/p&gt;

&lt;p&gt;We'll add our html and css same as with the previous cards, then you can add this &lt;code&gt;:hover&lt;/code&gt; state to the &lt;code&gt;.matrix&lt;/code&gt; class&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.matrix:hover {
  transform: matrix(.5, -1, 0, .5, 0, 0);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;matrix3d&lt;/code&gt; can create the illusion of 3 dimensions in 2 dimensions using CSS. The signature takes 16 arguments as coordinates.&lt;/p&gt;

&lt;p&gt;I'll copy all the stuff I just did for Matrix and just add 3d to the class name and text. Then we'll rotate this card up, right and out at the bottom using the &lt;code&gt;matrix3d&lt;/code&gt; function. We'll do this on the &lt;code&gt;:active&lt;/code&gt; psuedo class.&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;// ...
.matrix3d:active {
  transform: matrix3d(0.8535533905932737, 0.4999999999999999, 0.14644660940672619, 0, -0.4999999999999999, 0.7071067811865476, 0.4999999999999999, 0, 0.14644660940672619, -0.4999999999999999, 0.8535533905932737, 0, 22.62994231491119, -20.3223304703363, 101.3700576850888, 1);
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Below is a pen of all these examples.&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/konamax123/embed/aGZGVG/?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt; &lt;/iframe&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;I would love to hear any feedback that anyone has about my understanding of the &lt;code&gt;transform&lt;/code&gt; property. I wrote this post to re-enforce my knowledge of this concept. If I have made any glaring errors please let me know. I will gladly update this post with the correct information.&lt;/p&gt;

&lt;p&gt;This is a Cross Post from &lt;a href="https://medium.com/@brittanmcginnis/how-to-use-the-css-transform-property-b3b31f31316f"&gt;Medium&lt;/a&gt;&lt;/p&gt;


</description>
      <category>css</category>
      <category>cssanimations</category>
      <category>webdev</category>
    </item>
    <item>
      <title>How to use the CSS transition property</title>
      <dc:creator>Brittan McGinnis</dc:creator>
      <pubDate>Wed, 11 Apr 2018 03:33:14 +0000</pubDate>
      <link>https://dev.to/brittanmcg/how-to-use-the-css-transition-property-20mm</link>
      <guid>https://dev.to/brittanmcg/how-to-use-the-css-transition-property-20mm</guid>
      <description>

&lt;p&gt;Photo by Sabri Tuzcu on Unsplash&lt;/p&gt;

&lt;h1&gt;
  
  
  How to use the CSS &lt;code&gt;transition&lt;/code&gt; property
&lt;/h1&gt;

&lt;h3&gt;
  
  
  Or how I understand CSS transitions
&lt;/h3&gt;

&lt;p&gt;I'm on a journey to learn CSS animations and I decided to start with the CSS &lt;code&gt;transition&lt;/code&gt; property.&lt;/p&gt;

&lt;p&gt;Before reading through this you should have a basic understanding of HTML and CSS.&lt;/p&gt;

&lt;p&gt;This will cover the CSS transition property in as much depth as I feel I can go into. There will be other concepts thrown in here but I will gloss over them for now. This should be relatively basic and easy to understand, as I found this particular property pretty easy to understand.&lt;/p&gt;

&lt;p&gt;There are 4 &lt;code&gt;transition&lt;/code&gt; animation properties. They are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;transition-property &lt;/li&gt;
&lt;li&gt;transition-duration&lt;/li&gt;
&lt;li&gt;transition-timing-function&lt;/li&gt;
&lt;li&gt;transition-delay&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;&lt;strong&gt;I'll break down each of these properties here.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;code&gt;transition-property&lt;/code&gt;: This is the property that you want to animate. This could be &lt;code&gt;opacity&lt;/code&gt;, &lt;code&gt;width&lt;/code&gt;, &lt;code&gt;background&lt;/code&gt; or any number of different properties. The key thing to understand here is that you are defining what is going to be animated. Something to keep in mind is that not all properties are animatable (not sure if thats a word). A good rule of thumb is that if it has a middle state then you can probably animate it.&lt;/p&gt;

&lt;div class="table-wrapper-paragraph"&gt;&lt;table&gt;
&lt;thead&gt;
&lt;tr&gt;
&lt;th&gt;&lt;/th&gt;
&lt;th&gt;Start State&lt;/th&gt;
&lt;th&gt;transitioning&lt;/th&gt;
&lt;th&gt;End State&lt;/th&gt;
&lt;/tr&gt;
&lt;/thead&gt;
&lt;tbody&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;opacity&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;0&lt;/td&gt;
&lt;td&gt;0.5 👍&lt;/td&gt;
&lt;td&gt;1&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td&gt;&lt;code&gt;display&lt;/code&gt;&lt;/td&gt;
&lt;td&gt;none&lt;/td&gt;
&lt;td&gt;no middle state 😢&lt;/td&gt;
&lt;td&gt;block&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;&lt;/div&gt;

&lt;p&gt;&lt;code&gt;transition-duration&lt;/code&gt;: This is how long the animation will take place for. Or how long it will take to complete. Something to keep in mind when you are using this duration is that it's annoying to users if this takes to long. Alternatively it's jarring if it happens to fast or may be imperceptible that it even animated. Try and find a happy medium that feel right and has a purposeful duration.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;transition-delay&lt;/code&gt;: This is how long it will delay before the animation starts. You may want to have multiple animations happening at the same time but maybe you want to delay your background transition for &lt;code&gt;0.25s&lt;/code&gt; before you start to transition the changing color.&lt;/p&gt;

&lt;p&gt;&lt;code&gt;transition-timing-function&lt;/code&gt;: This one is a little tricky to understand. Essentially it's the function that you give your animation to perform during this animation.&lt;/p&gt;

&lt;p&gt;You have the choice between:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;ease&lt;/code&gt; - the default value (arguably the most used). Gives a soft start and moves in to the transition.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-in&lt;/code&gt; - slow in the beginning, fast / abrupt at the end&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-out&lt;/code&gt; - fast/abrupt in the beginning and slow at the end&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;ease-in-out&lt;/code&gt; - Honestly I can't really see a difference between the &lt;code&gt;ease-in&lt;/code&gt; function but it basically a mixture of the two above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;linear&lt;/code&gt; - same consistent speed all the way through&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;cubic-bezier&lt;/code&gt; - This is a series xy coordinates passed to a function that will map the control points for a timing curve. This one is s little tricky and deserves a more in-depth description than I will provide here. &lt;a href="https://callmenick.com/dev/level-up-animations-cubic-bezier/"&gt;Cubic Bezier&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can shorthand these properties by using the &lt;code&gt;transition&lt;/code&gt; property and adding the properties as illustrated below.&lt;br&gt;
&lt;code&gt;transition: [property] [duration] [delay] [timing-function];&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Here is an example of a transition on a button element. &lt;/p&gt;

&lt;p&gt;We'll start with some HTML and CSS&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="c"&gt;&amp;lt;!--Start HTML--&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;body&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;main&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"container"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    &lt;span class="nt"&gt;&amp;lt;button&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"btn"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Submit&lt;span class="nt"&gt;&amp;lt;/button&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;/main&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/body&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;





&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* Start CSS */
body {
  background: lightblue;
}

.container {
  text-align: center;
}

.btn {
  margin: 20px auto;
  padding: 20px;
  width: 180px;
  border-radius: 20px;
  font-size: 1.4em;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then we'll add color and a hover state&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* ... */

.btn {
  margin: 20px auto;
  padding: 20px;
  width: 180px;
  border-radius: 20px;
  font-size: 1.4em;
  background: papayawhip;
}

.btn:hover {
  background: azure;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Then we'll add a transition&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* ... */

.btn {
  margin: 20px auto;
  padding: 20px;
  width: 180px;
  border-radius: 20px;
  font-size: 1.4em;
  background: papayawhip;
  transition: background .5s ease; 
  /* Targets the background property and sets it to ease into the azure color in .5 seconds */
}

.btn:hover {
  background: azure;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;We can also add a grow animation as well&lt;/p&gt;



&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;/* ... */

.btn {
  /* ... */
  transition: background .5s ease .25s, width .25s ease-in-out;
}

.btn:hover {
  background: azure;
  width: 210px;
}
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;You can see the working example here:&lt;br&gt;
&lt;iframe height="600" src="https://codepen.io/konamax123/embed/jzdXve/?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt; &lt;/iframe&gt;&lt;br&gt;
This is a fairly contrived example but I feel like it illustrates a basic use case of this property without adding too much confusion.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Next Steps&lt;/strong&gt;&lt;br&gt;
I'll be moving onto CSS transformations next. I'm excited to see how I can use both these properties together to make something cool.&lt;/p&gt;

&lt;h3&gt;
  
  
  Side note
&lt;/h3&gt;

&lt;p&gt;This blog post is part of a learning framework that I am trying to follow. There are several modules that you have to complete for every step of your learning process. Teaching is one of those modules and that is what this blog post is. This framework comes from John Sonmez' 10 steps to learn anything quickly. &lt;a href="https://simpleprogrammer.com/store/products/learn-anything-quickly/"&gt;John's Course&lt;/a&gt;. I don't make any money if you buy this as I am not affiliated in any way. I do highly recommend it though.&lt;/p&gt;


</description>
      <category>css</category>
      <category>animation</category>
      <category>webdev</category>
      <category>learning</category>
    </item>
  </channel>
</rss>
