<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0"><channel><title><![CDATA[John O'Connell's blog]]></title><description><![CDATA[I'm a Front-End focused Web Developer.
I have fun building websites that work well.
Some of them even look good!]]></description><link>https://blog.jtocodes.com</link><generator>RSS for Node</generator><lastBuildDate>Thu, 30 Apr 2026 10:26:29 GMT</lastBuildDate><atom:link href="https://blog.jtocodes.com/rss.xml" rel="self" type="application/rss+xml"/><language><![CDATA[en]]></language><ttl>60</ttl><item><title><![CDATA[Get a Better Understanding of Accessibility & Semantic HTML]]></title><description><![CDATA[Introduction
The structure of a web page is fundamental in creating a great user experience. While working as a developer I’m sure you’ve come to understand how important well-structured code is. A poorly architected page is doomed from the start. It...]]></description><link>https://blog.jtocodes.com/get-a-better-understanding-of-accessibility-and-semantic-html</link><guid isPermaLink="true">https://blog.jtocodes.com/get-a-better-understanding-of-accessibility-and-semantic-html</guid><category><![CDATA[Accessibility]]></category><category><![CDATA[Web Accessibility]]></category><category><![CDATA[HTML5]]></category><dc:creator><![CDATA[John O'Connell]]></dc:creator><pubDate>Thu, 17 Mar 2022 04:58:07 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647492736135/CvReecLmP.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>The structure of a web page is fundamental in creating a great user experience. While working as a developer I’m sure you’ve come to understand how important well-structured code is. A poorly architected page is doomed from the start. It’s all too easy to get lost in countless nests of <code>divs</code>, spans, and if you’re really unlucky, tables. </p>
<p>Over the years the HTML spec has improved massively. Gone are the days when our options are limited to a generic one-size-fits-all element with no real meaning. </p>
<p>Thankfully now, we have Semantic HTML. This is a huge step forward not only for the developer but the user as well. </p>
<p>Lets explore why. </p>
<h2 id="heading-who-needs-accessibility">Who needs Accessibility?</h2>
<p>If I were to ask you to guess what percentage of the population had a disability, what would your answer be?</p>
<p>In a former role, I was responsible for teaching workshops centered around user experience in mobile apps.</p>
<p>in one of my early classes, things got off the rails as when I encountered several people in the class were unable to see the web page. They were older and had become accustomed to using the screen magnifier or the zoom feature. However this time the page they were viewing wouldn’t zoom properly. </p>
<p>Another had a different method, this guy was clever, had a hearing aid that his phone connected to wirelessly. When he needed to, he used the screen reader to navigate the page. </p>
<p>In almost every workshop, someone was attending because they were unable to use a web page or application properly due to lack of accessibility features. They were all understandably frustrated and were seeking a solution. </p>
<p>To be honest, this surprised me at the time. I didn’t think anyone used those features. After some googling I came to learn that According to the World Health Organization: 15% of the global population lives with a disability. That’s more than 1 billion people. According to the United States Census Bureau : 12.7% of Americans lives with a disability. Roughly 41.1 million people. </p>
<p>Even with a large margin of error applied to those numbers, there is no denying that the demographic for accessibility features has to be quite large.</p>
<p>Personally, I want everything I work on to be as accessible and enjoyable as possible for every potential user. We take measures in our communities to make things accessible for everyone, and are always working to improve. The same should apply for the web. </p>
<h2 id="heading-probably-your-users">Probably Your Users.</h2>
<p>The figures above represent a staggering number of potential users that may experience similar difficulties when using the web. </p>
<p>When things don’t work properly, especially things that should be simple, or are intended to make life easier, it can be frustrating.</p>
<p>Imagine what a user must feel when they’re trying to complete a task or get some information and the website is working against them. Despite the popular notion that technology and convenience go hand-in-hand, that isn't always the case.</p>
<p> As we now know, for millions of people, not taking accessibility into account could make their user experience much worse, maybe even impossible.</p>
<p>Its unlikely a user ever returns to your website after it frustrates them or doesn’t take their preferences and needs into consideration.</p>
<h2 id="heading-make-your-work-accessible-with-semantic-html">Make Your Work Accessible w/ Semantic HTML</h2>
<p>So how do we use what we know about the challenges surrounding accessibility, to begin structuring our web pages in a more accessible way?</p>
<p>By learning about Semantic HTML, and using Semantic HTML elements as much as possible.</p>
<h3 id="heading-what-is-semantic-html">What is Semantic HTML?</h3>
<p>What does a <code>div</code> mean in HTML markup? Well, nothing really. Although we can use them for almost anything in our markup, a div doesn't inherently represent anything. We use them to group content together and for styling purposes. Since a div element has no context or explicit purpose, browsers don't quite know how to make logical sense of it.  Not only that, but by not taking advantage of the proper elements, you’re also potentially missing out on key accessibility features that many elements provide.</p>
<p>Accessibility and HTML is a deep topic, there is a lot to be explored and learned about making pages more accessible and I encourage you keep taking steps towards writing more accessible code.  For the remainder of this article though, I’m going to focus on replacing div elements with more useful semantic elements. These elements, known as “content sectioning” elements, allow you to organize your document into logical pieces.</p>
<h2 id="heading-content-sectioning-elements">Content Sectioning Elements</h2>
<p>Rather than use <code>divs</code> to create our layouts, we can use these semantic elements instead.  Here are the ones you can use right away to start replacing div elements in your pages and making them more accessible. Semantic elements are lighter than div based layouts, so your page will be slightly faster as well.</p>
<ul>
<li><p><code>&lt;section&gt;</code>- We use section elements to represent a standalone section of a document, this is probably the closest semantic equivalent <code>div</code>.</p>
<p>Sections should almost always have a heading to define the content within.</p>
</li>
<li><p><code>&lt;header&gt;</code> - is used as an element that contains the introductory content of a document. Often logos, search forms, and navbars can are placed within these elements. *This is not the same as the “ element.</p>
</li>
<li><p><code>&lt;article&gt;</code>- represents a self-contained block of content, which is intended to be independently distributed, published or reused (in syndication).  Things like blog entries, forum posts, product cards, and user comments could appropriately use this element. “If you remove the rest of the site, can this content stand on its own?”</p>
</li>
<li><p><code>&lt;aside&gt;</code>- This element is for a portion of a document whose content is only related to the main content. These are often used for sidebars or call-out boxes.</p>
</li>
<li><p><code>&lt;nav&gt;</code>- Used to hold site navigation elements such as menus, tables of contents, index, or navbars.</p>
</li>
<li><p><code>&lt;main&gt;</code>- Used to represent the primary content of the documents body. The main content area could be considered the central functionality of an application, and is the primary topic of focus for any page.</p>
</li>
<li><p><code>&lt;footer&gt;</code>- Usually used for additional links, contact information and legal notices, the footer is often the last part of a document.</p>
</li>
<li><p><code>&lt;h1&gt;,&lt;h2&gt;,&lt;h3&gt;,&lt;h4&gt;,&lt;h5&gt;,&lt;h6&gt;</code>- The heading elements are important for establishing a hierarchy. Use these to build a “table of contents” into your document by organizing your content with the proper heading.</p>
</li>
</ul>
<h2 id="heading-in-conclusion">In Conclusion</h2>
<p>Being a bit more mindful and using semantic elements is a start, and its easy to fall back on old habits. We know that we can use CSS or JavaScript to make almost any HTML element behave the way you want.  You could easily make a button out of a div, span anchor tag, or li for example.</p>
<p>But when you have a hammer, every problem starts to look like a nail. </p>
<p>What we need to keep in mind is that as developers we have not just hammers, but an entire hardware store of tools at our disposal. Anyone can apply brute force with a hammer, so to speak. However, those particularly skilled in their craft always strive to use the right tool for the task at hand, and their work, and their users, are better off because of it.</p>
<hr />
<p>If you're interested in learning everything there is to know about accessibility and semantic HTML, I cant recommend <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Learn/Accessibility/HTML#html_and_accessibility">MDN</a> enough. They practically wrote the book on it.</p>
<blockquote>
<p>I'm still pretty new to the whole article / blog post thing. If you have any feedback or comments, please don't be shy and let me know what you think, what I did wrong, and how I can do better. Thanks for reading. </p>
</blockquote>
]]></content:encoded></item><item><title><![CDATA[Wrap Your Head Around: Meta Tags.]]></title><description><![CDATA[What is a Meta Tag?
Meta tags are HTML tags that we use to provide information about a website and it’s content. They are put in head head of a document, to be used by search engines and browsers to make sense of the content within our page and under...]]></description><link>https://blog.jtocodes.com/wrap-your-head-around-meta-tags</link><guid isPermaLink="true">https://blog.jtocodes.com/wrap-your-head-around-meta-tags</guid><category><![CDATA[HTML5]]></category><category><![CDATA[SEO]]></category><dc:creator><![CDATA[John O'Connell]]></dc:creator><pubDate>Tue, 15 Mar 2022 01:49:53 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1647308598141/9gOhf4gE6.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h2 id="heading-what-is-a-meta-tag">What is a Meta Tag?</h2>
<p>Meta tags are HTML tags that we use to provide information about a website and it’s content. They are put in head head of a document, to be used by search engines and browsers to make sense of the content within our page and understand what a website is about. </p>
<p>If you “View Source” or “Inspect” almost any web page, you’ll see meta tags within the head of the document providing all sorts of useful information about it, such as a document’s character set, description, keywords, author, and viewport settings. Search engines use this information to help index a page and get a better understanding of it.</p>
<h2 id="heading-why-use-them">Why Use Them?</h2>
<p>When it comes to SEO, (Search Engine Optimization) Meta tags play an important role. Particularly the title tag and the meta description. This is because these tags are what you will see on a search engines results page (SERP) when you search for your site. It’s important to have unique meta tags for every page, with a relevant title and description. </p>
<p>It almost goes without saying that users will not click on your site, if it isn’t related to exactly what they’re searching for.</p>
<h2 id="heading-how-to-use-meta-tags">How To Use Meta Tags.</h2>
<p>Meta tags are self closing. Which means rather than having content between an opening and closing tag, all of the data for our meta tags gets defined as attributes in key/value pairs.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"example"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"this is an example of a meta tag"</span> /&gt;</span>
</code></pre>
<p>Many of the most popular meta tags are just a simple combination of a <code>name</code> and <code>content</code> attribute.</p>
<p>Essentially we’re saying “This is our data, and this is what it does”. The <code>name</code> attribute serves the purpose of being descriptive of the data itself. The <code>content</code> attribute’s value, is the actual data associated with the <code>name</code>.</p>
<p>Although the <code>name</code> attribute is most common, a meta data attribute can be any of the following:</p>
<ul>
<li><code>name</code>:  provides document level data that applies to the whole page.  This attribute allows us to define the name of our metadata, and is paired with the <code>content</code> attribute. Essentially we are telling the browser what data we’re providing it.</li>
<li><code>http-equiv</code>: if this is used, the element can provide information similar to that found in an HTTP header.</li>
<li><code>content</code>:  is the value associated with the <code>name</code> or the <code>http-equiv</code> attribute.</li>
<li><p><code>charset</code>: defines the character encoding, or character set we are using, to the browser. In most cases we use Unicode, which covers most symbols that exist in just about every language.</p>
<p>  <em>It is also the only valid encoding for HTML5 documents.</em></p>
<pre><code class="lang-html">  <span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">charset</span>=<span class="hljs-string">"UTF-8"</span> /&gt;</span>
</code></pre>
</li>
<li><p><code>itemprop</code>: this is user defined meta data that cannot be represented by the standard types and attributes.</p>
<p>  <em>*This attribute can not be used on an element that has any existing <code>name</code>, <code>http-equiv</code>, or <code>charset</code> attributes. in other words, it must be used by itself.</em></p>
</li>
</ul>
<h2 id="heading-popular-attributes-and-values">Popular Attributes and Values.</h2>
<p>Now that we’re starting to wrap our heads around meta tags, lets take a look at some of the most commonly used meta elements and some of their attributes. 
There are a lot of different meta tags, some are important, others don’t work any more and are depreciated.  I’m only going to go over the important ones here to keep it relatively simple.
 These are the ones that should be used on every page, either for the benefit of the user, or a search engine.</p>
<h3 id="heading-title">Title</h3>
<p>I realize this doesn't start with “meta”, but each page should have a <code>&lt;title&gt;</code> tag. This serves as the name of our webpage for search engines and visitors, and is most prominently displayed in search results.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">title</span>&gt;</span>Wrap Your Head Around: Meta Tags<span class="hljs-tag">&lt;/<span class="hljs-name">title</span>&gt;</span>
</code></pre>
<h3 id="heading-description">Description</h3>
<p>A few short sentences of what content can be expected on your website. Usually displayed beneath the title in a search result.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"description"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"An informative article about HTML Meta Tags."</span>&gt;</span>
</code></pre>
<h3 id="heading-charset">Charset</h3>
<p>To display a page properly, the browser needs to know what character set to use. Currently we use Unicode, or UTF-8 which covers almost all of the characters and symbols in the world! Additionally, the HTML5 spec says this is only valid charset, so we don’t have much of a choice, not that we’d need one.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"description"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"An informative article about HTML Meta Tags."</span>&gt;</span>
</code></pre>
<h3 id="heading-viewport-setting-it-for-responsive-design">Viewport - Setting it for Responsive Design.</h3>
<p>Because this particular tag is so important to making our pages responsive, I thought it best to give it a space of its own.</p>
<p>We use the <code>viewport</code> meta tag to tell the browser what kind of device is being used. This makes web browsers aware of what device being used to view our page, and scales it appropriately. Lets break this down:</p>
<p><code>content="width=device-width</code>  tells the browser that our pages width should match the width of the current device.</p>
<p><code>initial-scale=1.0</code>  scales the initial zoom level when the page is loaded by the browser.  </p>
<p>So this tag basically says “match our pages with to the with to the device being used, and make it full sized (100%) ”. So whether we use a watch, phone, tablet or desktop, our content will be sized and scaled appropriately.</p>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">"viewport"</span> <span class="hljs-attr">content</span>=<span class="hljs-string">"width=device-width, initial-scale=1.0"</span>&gt;</span>
</code></pre>
<h2 id="heading-the-end">The End</h2>
<pre><code class="lang-html"><span class="hljs-tag">&lt;<span class="hljs-name">meta</span> <span class="hljs-attr">name</span>=<span class="hljs-string">“conclusion”</span> <span class="hljs-attr">content</span>=<span class="hljs-string">“End</span> <span class="hljs-attr">of</span> <span class="hljs-attr">Article</span>” /&gt;</span>
</code></pre>
<p>Thanks for reading my quick overview of meta tags. I covered the basics above, but there is always more to learn.</p>
<p>If you want a more technical explanation, I’d recommend checking out the MDN Docs. </p>
]]></content:encoded></item><item><title><![CDATA[Wrap Your Head Around: CSS Animations]]></title><description><![CDATA[Introduction
I really appreciate a good UX. When a site I’m browsing comes to life, I really get a kick out of it. A lot of the web can be kind of, familiar. You see certain design elements so frequently that they start to feel predictable. When I en...]]></description><link>https://blog.jtocodes.com/wrap-your-head-around-css-animations</link><guid isPermaLink="true">https://blog.jtocodes.com/wrap-your-head-around-css-animations</guid><category><![CDATA[CSS]]></category><category><![CDATA[CSS Animation]]></category><dc:creator><![CDATA[John O'Connell]]></dc:creator><pubDate>Fri, 25 Feb 2022 16:26:47 GMT</pubDate><enclosure url="https://cdn.hashnode.com/res/hashnode/image/upload/v1646709858779/djyHBZsi0.png" length="0" type="image/jpeg"/><content:encoded><![CDATA[<h1 id="heading-introduction">Introduction</h1>
<p>I really appreciate a good UX. When a site I’m browsing comes to life, I really get a kick out of it. A lot of the web can be kind of, familiar. You see certain design elements so frequently that they start to feel predictable. When I encounter a great animation or find myself pleasantly surprised by an interactive element, I appreciate it. It's memorable and I find it leaves a lasting impression. It’s one of the reasons I enjoy visiting Apple’s website. They always find a way to add a refreshing flair to their pages. I almost always hear myself saying "Oh, that's cool!"</p>
<p>One way we can bring a similar flair in our own work is by using CSS animations. CSS provide us with a set of tools that makes it easy to add animation sequences of own design to our DOM elements. Let’s take a look at how we can use animations in our work  to make our pages and components more interesting. </p>
<h4 id="heading-before-we-get-started">Before We Get Started</h4>
<p>I've included a several examples. If you want to see the code in action, you can check out the CodePen <a target="_blank" href="https://codepen.io/IAmJohnOConnell/pen/jOaLWPb">here</a>. Fork yourself a copy and experiement!</p>
<h1 id="heading-general-concepts">General Concepts</h1>
<h2 id="heading-the-animation-and-transition-properties">The Animation and Transition Properties</h2>
<p>When animating things in CSS we are given two properties to handle the task. <em><code>Transition</code></em> and <em><code>Animation</code></em>.  Each has their own advantages and disadvantages and choosing which to use depends on what you’re trying to accomplish. </p>
<h3 id="heading-transition">Transition</h3>
<p>The quickest way to get an animation working is with the <code>transition</code> property. It gives us the ability to describe how an element changes from one state to another. You can think of these as "A to B" animations. Usually, these are used in conjunction with pseudo-selectors like <code>:hover</code>, because they can be used to easily trigger a state change. </p>
<p>Transitions are easy to understand and use, but are limited when you want to add more complexity to an animation. If you need more control over the timing and other characteristics of your animation we need to use the <code>animation</code> property instead.</p>
<h3 id="heading-animation">Animation</h3>
<p>The <code>animation</code> property lets us configure things like the timing, duration, and other details of how our animation should progress. <code>animation</code> is actually a shorthand for <code>animation-name</code> which also has several sub-properties that we can use to further configure our animation sequence. These sub-properties along with the use of <code>keyframes</code> allow us to do things that are not possible with the <code>transition</code> property alone.</p>
<p>A list of <code>animations</code> sub-properties can be found <a target="_blank" href="https://developer.mozilla.org/en-US/docs/Web/CSS/animation">here</a></p>
<p>despite the added flexibility we gain from using <code>animation</code> and its sub-properties, it's not often that we find ourselves needing <em>all</em> of them. Actually, we really only need to give it a name and duration (A duration is not technically required either, but the initial value is 0s. So, if you want your animation to play, you need to specify a duration). Because of this, I opt to use the <code>animation</code> shorthand property on its own, only change the properties I need and allow the browser to handle the rest.</p>
<h2 id="heading-keyframes">Keyframes</h2>
<p>Another fundamental concept to understand when it comes to animations, of Keyframes.  </p>
<h3 id="heading-what-is-a-keyframe-anyway">What is a Keyframe anyway?</h3>
<p>Take a moment to think about a classic, “flip-book” style animation. 
There is a slightly different drawing on each page, then as the reader quickly flips through the pages, the images appear one after the other, giving the appearance of motion. Each of these individual pages is called a <code>frame</code>.</p>
<p>A <code>Key frame</code> (or <code>keyframe</code>) then, is essentially a moment in time in our animation. We can use <code>keyframes</code> to define what we want to happen in our animation, and when it should occur. The browser then uses a process called <code>tweening</code> to calculate what should be happening between the <code>keyframes</code> we’ve defined, and fills them in for us, this is how the illusion of motion is created.</p>
<p><code>Keyframes</code> are used to control the steps in an animation sequence, by allowing us to define the styles for that particular frame. </p>
<h4 id="heading-did-you-know">Did You Know?</h4>
<p>The concept of keyframes goes well beyond CSS! Keyframes are an essential part of both animation and filmmaking. You can read more about keyframes <a target="_blank" href="https://en.wikipedia.org/wiki/Key_frame">here</a></p>
<h3 id="heading-how-to-use-keyframes">How To Use Keyframes</h3>
<p>Using <code>keyframes</code> is fairly simple. We define our animation by giving it a name, and specifying where our keyframes exist in our animation sequence, by using a percentage of time. Within each keyframe we can define the styles of our element.</p>
<pre><code class="lang-css"><span class="hljs-keyword">@keyframes</span> slidein {
  <span class="hljs-selector-tag">from</span> {
    <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translateX</span>(<span class="hljs-number">0%</span>);
  }

  <span class="hljs-selector-tag">to</span> {
    <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translateX</span>(<span class="hljs-number">100%</span>);
  }
}
</code></pre>
<p>This creates an animation called <code>slidein</code>. We’ll use this name to reference the animation later in our CSS rule. Notice how rather than using a percentage above, I’ve used the values <code>from</code> and <code>to</code>. This is another way of saying <code>0%</code> (from) and <code>100%</code> (to), in a more readable way.</p>
<pre><code class="lang-css"><span class="hljs-keyword">@keyframes</span> slidein {
  0% {
    <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translateX</span>(<span class="hljs-number">0%</span>);
  }

  100% {
    <span class="hljs-attribute">transform</span>: <span class="hljs-built_in">translateX</span>(<span class="hljs-number">100%</span>);
  }
}
</code></pre>
<h1 id="heading-what-have-we-learned-so-far">What Have We Learned So Far?</h1>
<p>We now know that we have two primary options when it comes to using animations in CSS. The <code>transition</code> property let’s us make simple “a to b” animations, and the <code>animation</code> property gives us complete control  over our animations along with some added complexity. </p>
<p>We can then use <code>keyframes</code> or a pseudo selector to trigger our animation on the proper element. </p>
<p>Now that we have basic understanding of the fundamentals, let’s see them in action. </p>
<h1 id="heading-examples">Examples</h1>
<p>In our example we have a box that we are going animate by using two methods we just learned about. </p>
<h2 id="heading-using-the-animation-property">Using the Animation Property</h2>
<p>First we use the animation property to apply our animation to the box element.</p>
<p> We do this by using the same name that we define in our <code>keyframes</code>, which references the animation we want to use. </p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span> {
    <span class="hljs-attribute">animation</span>: colorChange <span class="hljs-number">3s</span>
}

<span class="hljs-keyword">@keyframes</span> colorChange {
    <span class="hljs-selector-tag">from</span> {
        <span class="hljs-attribute">background-color</span>: blue;
    }
    <span class="hljs-selector-tag">to</span> {
        <span class="hljs-attribute">background-color</span>: green;
    }
}
</code></pre>
<p>Notice that because we are using the animation property, which is a shorthand we can specify the other parameters we need and omit what we don’t and the browser will handle the rest. We’ve specified a name ( colorChange) and and duration (3s) for our animation. </p>
<p>Below our box element we’ve defined our colorChange animation using the <code>keyframes</code> at-rule. We also use the aliases “from” and “to”.  Because we want our box to go <em>from</em> (0%) blue <em>to</em> (100%) green. </p>
<h2 id="heading-using-the-transition-property">Using the Transition Property</h2>
<p>And here is the exact same animation but this time we use the <code>transition</code> property to achieve the same results. </p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">background-color</span>: blue;
    <span class="hljs-attribute">transition</span>: all <span class="hljs-number">3s</span> linear;
}

<span class="hljs-selector-class">.box</span><span class="hljs-selector-pseudo">:hover</span> {
  <span class="hljs-attribute">background-color</span>: red;
}
</code></pre>
<p>Rather than use <code>keyframes</code>, like we do when using the <code>animation</code> property. When using <code>transition</code> we don't need a separate name or keyframe rule for the animation. Instead, since we are just changing our element’s color from one state to another, we can make use of pseudo-selectors, in this case <code>:hover</code>, to act as the trigger for our animation.</p>
<h2 id="heading-adding-complexity-with-the-animation-property">Adding Complexity w/ the Animation Property</h2>
<p>As I mentioned earlier, the <code>animation</code> property can be used to add additional complexity to our animation sequences that the transition property is not equipped to handle.</p>
<p>Let’s revisit our earlier example, but this time, I want to make it so that the box changes colors a few more times. Lets change it to cycle though all of the colors of the rainbow. (ROYGBIV)</p>
<p>After some quick math, we know that each color change should take roughly 14% of our total animation. (100 / 7 = 14.28).  Lets add the remaining <code>keyframes</code> and test our new animation.</p>
<pre><code class="lang-css"><span class="hljs-selector-class">.box</span> {
  <span class="hljs-attribute">animation</span>: colorChange <span class="hljs-number">3s</span>;
}

<span class="hljs-keyword">@keyframes</span> colorChange {
  0% {
    <span class="hljs-attribute">background-color</span>: red;
  }

  14% {
    <span class="hljs-attribute">background-color</span>: orange;
  }

  42% {
    <span class="hljs-attribute">background-color</span>: yellow;
  }

  56% {
    <span class="hljs-attribute">background-color</span>: green;
  }

  70% {
    <span class="hljs-attribute">background-color</span>: blue;
  }

  84% {
    <span class="hljs-attribute">background-color</span>: indigo;
  }

  98% {
    <span class="hljs-attribute">background-color</span>: violet;
  }
}
</code></pre>
<p>After adding the remaining <code>keyframes</code> and telling our CSS what color we’d like our element to be at each one, we’ll see our updated animation come to life. Our box element will cycle through each of the colors, playing our animation sequence just as we’ve defined it in our keyframes.</p>
<h1 id="heading-the-end">The End</h1>
<p>By now you should have a better understanding of CSS animations. Some nice animations can be the difference between an average site and a pleasant one, so take the time to dive into the topic even further. This is a good start, but what we've covered here is only the beginning of what is possible.</p>
<p>Thanks for reading!</p>
<h3 id="heading-live-examples">Live Examples</h3>
<p>If you want to see the examples in this article in action, you can fork the CodePen <a target="_blank" href="https://codepen.io/IAmJohnOConnell/pen/jOaLWPb">here</a>.</p>
]]></content:encoded></item></channel></rss>