<?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>Forem: Jerry Jones</title>
    <description>The latest articles on Forem by Jerry Jones (@jeryj).</description>
    <link>https://forem.com/jeryj</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%2F392122%2Ff9b67b22-872a-4380-9ed4-fdc4ed4182e7.jpeg</url>
      <title>Forem: Jerry Jones</title>
      <link>https://forem.com/jeryj</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/jeryj"/>
    <language>en</language>
    <item>
      <title>Random 3D Orbit around Central Planet</title>
      <dc:creator>Jerry Jones</dc:creator>
      <pubDate>Sat, 23 May 2020 21:23:54 +0000</pubDate>
      <link>https://forem.com/jeryj/random-3d-orbit-around-central-planet-l5</link>
      <guid>https://forem.com/jeryj/random-3d-orbit-around-central-planet-l5</guid>
      <description>&lt;p&gt;Randomly sized mini-planets orbiting around a central planet/sun. You can increase and decrease the pull. Definitely not accurate physics-wise as 0% gravity actually does have some pull... and probably lots of other things wrong too...&lt;/p&gt;

&lt;p&gt;But, it's fun to watch!&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/jeryj/embed/GGQVYo?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>css</category>
      <category>javascript</category>
    </item>
    <item>
      <title>The Importance of HTML</title>
      <dc:creator>Jerry Jones</dc:creator>
      <pubDate>Sat, 23 May 2020 14:08:03 +0000</pubDate>
      <link>https://forem.com/jeryj/the-importance-of-html-1fcm</link>
      <guid>https://forem.com/jeryj/the-importance-of-html-1fcm</guid>
      <description>&lt;p&gt;In 1917, the artist Michael Duchamp submitted his work, "Fountain," to an art exhibition. It's a used urinal. And it stirred up yet another conversation about, "What &lt;em&gt;is&lt;/em&gt; art?"&lt;/p&gt;

&lt;p&gt;I've only taken one art history class, so forgive my simplification here. Essentially, art is subjective. If you personally don't like Duchamp's urinal, it doesn't make it any less art.&lt;/p&gt;

&lt;p&gt;JavaScript and CSS are the focus of most web designer/developer's learning, but they're subjective to the end user. There are better and worse ways to write your CSS and JS, but none are 100% right or wrong (as long as your page still works, is secure, etc).&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;HTML has clearly right and wrong ways to write it, and this is too often ignored.&lt;/strong&gt; Here are several examples I've seen in the wild:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A "button" that's actually a clickable &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and not a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;A "title" that's actually a&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and not a heading element  (&lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;, &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;, etc).&lt;/li&gt;
&lt;li&gt;A "label"" for an &lt;code&gt;&amp;lt;input&amp;gt;&lt;/code&gt; that's actually a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;li&gt;An "input" that's actually a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; with keydown listeners.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Notice a pattern? Looking at you, &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;. 👀&lt;/p&gt;

&lt;p&gt;The essential issue is using a non-semantic element when a semantic element should have been used.&lt;/p&gt;

&lt;h2&gt;
  
  
  What Do We Mean by Semantic?
&lt;/h2&gt;

&lt;p&gt;Semantic means that the element has a meaning. It says something about the content or its relationship to another thing. In HTML, basically anything that isn't a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; is semantic. &lt;/p&gt;

&lt;p&gt;There's also a continuum to what a tag tells us about the meaning of its content. For example, a &lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; tells us less about its contents than an &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt;. &lt;/p&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;section&amp;gt;&lt;/code&gt; is still semantic, as it tells us that its contents should be considered as a group. But, an &lt;code&gt;&amp;lt;article&amp;gt;&lt;/code&gt; tells its contents are grouped together and that it's a cohesive article.&lt;/p&gt;

&lt;p&gt;For more examples, I'll walk through the Heading and Button elements to demonstrate how they are semantic.&lt;/p&gt;

&lt;h3&gt;
  
  
  Heading Elements
&lt;/h3&gt;

&lt;p&gt;An &lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt; is a title of a page, and an &lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt; beneath it gives a hierarchy to the page.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- h1, the most important part --&amp;gt;
&amp;lt;h1&amp;gt;The Importance of HTML&amp;lt;/h1&amp;gt;
&amp;lt;!-- "What Do We Mean by Semantic?" is a subsection of "The Importance of HTML" --&amp;gt;
&amp;lt;h2&amp;gt;What Do We Mean by Semantic?&amp;lt;/h2&amp;gt;
&amp;lt;!-- "Headings" is a subsection of "What Do We Mean by Semantic?" --&amp;gt; 
&amp;lt;h3&amp;gt;Headings&amp;lt;/h3&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Using an appropriate heading structure, you can automatically create a table of contents. Here's how this article could be built into a table of contents just based off of the heading levels:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h1&amp;gt;&lt;/code&gt;: The Importance of HTML

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;: What Do We Mean by Semantic?

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt;: Headings&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h3&amp;gt;&lt;/code&gt;: Buttons&lt;/li&gt;
&lt;/ul&gt;


&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;: Non-Semantic Elements&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;h2&amp;gt;&lt;/code&gt;: Correct HTML Does Not Bring You Glory, But You Need to Do It&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;You can see the structure of the whole article being communicated just via the HTML. If I had used all &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s, then the structure would look like: &lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: The Importance of HTML&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: What Do We Mean by Semantic?&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: Headings&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: Buttons&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: Non-Semantic Elements&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;: Correct HTML Does Not Bring You Glory, But You Need to Do It&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;There's no meaning attached to the &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;, so it would be a flat structure. Just by using the correct HTML we bring clarity and structure to the DOM.&lt;/p&gt;

&lt;h3&gt;
  
  
  Buttons
&lt;/h3&gt;

&lt;p&gt;A button submits or changes the state of something. By definition, it's always:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;focusable&lt;/li&gt;
&lt;li&gt;activated on space bar or enter key presses&lt;/li&gt;
&lt;li&gt;activated on mouse click.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;When you make a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; with a click listener, you're not using the semantic interactions that come for free when you use a &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt;. You have to manually build out the:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;focus state&lt;/li&gt;
&lt;li&gt;keyboard interactions&lt;/li&gt;
&lt;li&gt;mouse interactions&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Not only that, but when a screen reader comes to a &lt;code&gt;&amp;lt;button&amp;gt;Submit&amp;lt;/button&amp;gt;&lt;/code&gt;, it will use those semantics and announce, "Submit, button." &lt;/p&gt;

&lt;p&gt;The same thing using a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; would look like:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight plaintext"&gt;&lt;code&gt;&amp;lt;!-- Just kidding, I'm not going to make an accessible div button. --&amp;gt;
&amp;lt;!-- Use a &amp;lt;button&amp;gt; please! 😂--&amp;gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;When we use semantic HTML elements, we elevate the content's meaning. &lt;strong&gt;It gives the content life.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Non-Semantic Elements
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s are non-semantic elements. The &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; does not give the content any additional meaning. It's just a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;.&lt;/p&gt;

&lt;p&gt;I'm not being totally fair, as there is a tiny bit of meaning behind a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; vs a &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;A &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; is a block-level element, as in, it should wrap things together. &lt;/li&gt;
&lt;li&gt;A &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; is an inline element. It should be used within another element, like &lt;code&gt;&amp;lt;p&amp;gt;&amp;lt;span class="dropcap"&amp;gt;I&amp;lt;/span&amp;gt;nline elements&amp;lt;/p&amp;gt;&lt;/code&gt;.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If there are no HTML elements that make sense for the content, then use a &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; or &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;. There's 100% a place for &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt;s and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt;s. Not every piece of content or HTML element needs additional semantics.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;When writing HTML, use as specific of an element as makes sense for your content.&lt;/strong&gt; If there's nothing specific enough, then keep going for less and less meaningful tags. &lt;code&gt;&amp;lt;div&amp;gt;&lt;/code&gt; and &lt;code&gt;&amp;lt;span&amp;gt;&lt;/code&gt; are always the last choice.&lt;/p&gt;

&lt;h2&gt;
  
  
  Correct HTML Does Not Bring You Glory, But You Need to Do It
&lt;/h2&gt;

&lt;p&gt;You're not going to get a Webby Award or thousands of views on Codepen for how amazingly crafted your HTML is. You'll need to be OK going unrecognized for your work. But know that every time I use a screen reader or keyboard on a site &lt;em&gt;and it works correctly&lt;/em&gt;, I have a little spark of joy. I'm sure I'm not alone here.&lt;/p&gt;

&lt;p&gt;In the end, you'll have to be OK with knowing you did your best to make your work accessible to everyone.&lt;/p&gt;

</description>
      <category>html</category>
      <category>a11y</category>
      <category>codenewbie</category>
      <category>beginners</category>
    </item>
  </channel>
</rss>
