<?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: Cory Tanner</title>
    <description>The latest articles on DEV Community by Cory Tanner (@ctannerweb).</description>
    <link>https://dev.to/ctannerweb</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%2F269144%2Fca477e9f-093d-4043-86d4-0e578249a4bd.jpg</url>
      <title>DEV Community: Cory Tanner</title>
      <link>https://dev.to/ctannerweb</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/ctannerweb"/>
    <language>en</language>
    <item>
      <title>Beginner CSS: Center Content with Flexbox</title>
      <dc:creator>Cory Tanner</dc:creator>
      <pubDate>Mon, 25 May 2020 16:43:24 +0000</pubDate>
      <link>https://dev.to/ctannerweb/beginner-css-center-content-with-flexbox-c9p</link>
      <guid>https://dev.to/ctannerweb/beginner-css-center-content-with-flexbox-c9p</guid>
      <description>&lt;p&gt;The firehose of web development information out there can overwhelm even the smartest of people. If you're a beginner web developer, it can feel like there is no way to learn everything. But, try and keep things in perspective! The best steps are to start simple and continuously build on that foundational knowledge. &lt;/p&gt;

&lt;p&gt;So let's start simple! Centering content with CSS Flexbox.&lt;/p&gt;

&lt;h2&gt;
  
  
  CSS properties to learn
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;display: flex;&lt;/code&gt; - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/CSS_Flexible_Box_Layout/Basic_Concepts_of_Flexbox"&gt;Flexbox overview&lt;/a&gt;&lt;br&gt;
&lt;code&gt;justify-content: center;&lt;/code&gt; - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/justify-content"&gt;Overview&lt;/a&gt;&lt;br&gt;
&lt;code&gt;align-items: center;&lt;/code&gt; - &lt;a href="https://developer.mozilla.org/en-US/docs/Web/CSS/align-items"&gt;Overview&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  HTML/CSS Example
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;section&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"hero"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;h1&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"hero__heading"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;Hi&lt;span class="nt"&gt;&amp;lt;/h1&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/section&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;





&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.hero&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;flex&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;justify-content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;align-items&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.hero__heading&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;inline-block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The important aspects from the code above that you should note is that we are using the parent element &lt;code&gt;&amp;lt;section class="hero"&amp;gt;&lt;/code&gt; to center the content within it. Honestly it's that simple.&lt;/p&gt;

&lt;h3&gt;
  
  
  justify-content
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;justify-content: center;&lt;/code&gt; tells all child elements to align themselves center on the &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Main_Axis"&gt;main axis&lt;/a&gt;.&lt;/p&gt;

&lt;h3&gt;
  
  
  align-items
&lt;/h3&gt;

&lt;p&gt;&lt;code&gt;align-items: center;&lt;/code&gt; tells all child elements to align themselves center on the &lt;a href="https://developer.mozilla.org/en-US/docs/Glossary/Cross_Axis"&gt;cross axis&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;Have fun using this in your applications and I highly encourage you to master Flexbox and CSS Grid. These two CSS skills will be the foundation of app layout for many years to come.&lt;/p&gt;

&lt;h2&gt;
  
  
  Resources
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Codepen Example: &lt;iframe height="600" src="https://codepen.io/Ctannerweb/embed/gOajmBB?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;li&gt;YouTube:
&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/IyWku83os8Q"&gt;
&lt;/iframe&gt;
&lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>css</category>
      <category>beginners</category>
      <category>html</category>
    </item>
    <item>
      <title>How Inline SVG's Improve Performance</title>
      <dc:creator>Cory Tanner</dc:creator>
      <pubDate>Wed, 11 Dec 2019 20:41:44 +0000</pubDate>
      <link>https://dev.to/ctannerweb/how-inline-svg-s-improve-performance-4k37</link>
      <guid>https://dev.to/ctannerweb/how-inline-svg-s-improve-performance-4k37</guid>
      <description>&lt;p&gt;Progressive Web Apps (PWAs) are a new and exciting way to build web applications. With interest in PWAs growing among clients and developers alike, we need to rethink our development process to accommodate PWA performance. Let’s dive into managing SVG assets!&lt;/p&gt;

&lt;h2&gt;
  
  
  How to use SVGJar
&lt;/h2&gt;

&lt;p&gt;The bird's eye view description of this method is that we include every SVG on our app inline. The plugin &lt;a href="https://www.npmjs.com/package/ember-svg-jar"&gt;Ember SVGJar&lt;/a&gt; gives you a clean interface where you can interact with every icon added to the plugin. Which allows you to include every SVG inline on the app.&lt;/p&gt;

&lt;p&gt;Having inline SVG injection management with SVGJar offers a few advantages right away:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;SVG assets used with CSS background property&lt;/li&gt;
&lt;li&gt;SVG assets are included inline so you have full creative control over the SVG with CSS styling&lt;/li&gt;
&lt;li&gt;Most performant way of including optimized SVGs on a page&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;We organize our SVG assets in an asset folder linked to SVGJar. The plugin inserts the SVG assets into the page where you include the handlebar helper.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight handlebars"&gt;&lt;code&gt;&lt;span class="k"&gt;{{&lt;/span&gt;&lt;span class="nv"&gt;svg-jar&lt;/span&gt; &lt;span class="s2"&gt;"asset-name"&lt;/span&gt;&lt;span class="k"&gt;}}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The result is that the Ember app sees what SVGs are needed and, thanks to SVGJar, pulls the asset from the asset folder, injecting the SVG code directly into the HTML before it gets sent to the server and then browser.&lt;/p&gt;

&lt;p&gt;For developers working within React, you can easily make a SVG include component that holds all SVG assets. You then include that component into any template that needs a SVG and freely insert that inline SVG. Same method, just different tooling.&lt;/p&gt;

&lt;h2&gt;
  
  
  PWA Benefits
&lt;/h2&gt;

&lt;p&gt;When developing a PWA, it’s important to keep asset management  as lean as possible. Utilizing a performant way of including an SVG that is easily cached within HTML can significantly improve PWA performance. No tree shaking, no sending a large icon asset folder to the user, just clean and performant HTML files that get cached on the device.&lt;/p&gt;

&lt;p&gt;In the past, managing hundreds of inline SVGs was a development blocker but, with modern tooling, we can create SVG management tools that scale. These tools (SVGJar and a React SVG component) enable the developer to focus on the quality of their SVG assets over an implementation solution that is easier for the developer but less ideal for the performance of an application.&lt;/p&gt;

&lt;p&gt;Now you can get creative with SVGs and enhance how you develop PWAs.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post originally appeared on &lt;a href="https://dockyard.com/"&gt;DockYard&lt;/a&gt;, where I currently work as a Senior UX Developer. DockYard is a digital product agency offering exceptional strategy, design, full stack engineering, web app development, and custom software services, consulting, and training.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>svg</category>
      <category>css</category>
      <category>html</category>
      <category>pwa</category>
    </item>
    <item>
      <title>Harmony Between CSS Grid and Data Attributes</title>
      <dc:creator>Cory Tanner</dc:creator>
      <pubDate>Wed, 04 Dec 2019 19:00:42 +0000</pubDate>
      <link>https://dev.to/ctannerweb/narwin-grid-harmony-between-css-grid-and-data-attributes-1h9n</link>
      <guid>https://dev.to/ctannerweb/narwin-grid-harmony-between-css-grid-and-data-attributes-1h9n</guid>
      <description>&lt;p&gt;Building a complex responsive layout with one or two CSS declarations is beyond useful. In fact, CSS Grid has worked like magic for our team of UX Developers at DockYard. The only thing missing was a traditional 12-column grid that could be applied across the app suite we were working on.&lt;/p&gt;

&lt;p&gt;I wanted to describe a 12-column grid while retaining our CSS naming methodologies, and I wanted to make sure it didn’t lead to code bloat. I turned to data attributes as a unique solution. The theory was: each column 1 through 12 could be thought of as data, which CSS could then use to make decisions. &lt;/p&gt;

&lt;p&gt;In this post, I will demonstrate how this works, but ultimately, what I found is that this 12-column grid offers a consistent pattern developers can use in their web applications. Doing so brings balance and harmony to the look and feel of the application, and it’s a performance win: the HTML/CSS are reusable and repeatable, and when code is compressed, users will have smaller, faster assets to download.&lt;/p&gt;

&lt;p&gt;Currently we can do this work in about 200 lines of CSS, but in the future we could condense this to around 20 lines if data attributes get the ability to pass integers in CSS.&lt;/p&gt;

&lt;h2&gt;
  
  
  Overview of Grid Attributes
&lt;/h2&gt;

&lt;p&gt;We use custom data attributes that define a mobile-first grid layout using CSS Grid properties. Our 12-column grid is dependent on these attributes.   Small, medium, or large data attributes define the value of grid columns for small, medium, or large viewports in the web app. We call our grid, &lt;code&gt;narwin-grid&lt;/code&gt;. &lt;/p&gt;

&lt;h3&gt;
  
  
  narwin-grid Required Classes
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;narwin-grid&lt;/code&gt; is the block-level class name that acts as the container for the items. For example, &lt;code&gt;&amp;lt;form class=“narwin-grid”&amp;gt;&lt;/code&gt; will apply the grid system to the form.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;narwin-grid__item&lt;/code&gt; is the element-level class name that belongs on the element that will be sized by the grid. For example, &lt;code&gt;&amp;lt;fieldset class=“narwin-grid__item”&amp;gt;&lt;/code&gt; without any data attributes will default to a span of 12 columns.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Optional Data Attributes for narwin-grid Items
&lt;/h3&gt;

&lt;p&gt;The data attributes below are directly associated with &lt;code&gt;class=“narwin-grid__item”&lt;/code&gt;. The data attributes must be defined on the grid item, as seen in the code snippet below.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;code&gt;data-grid-small=“”&lt;/code&gt; takes values 1 through 12. This represents how many columns an element can span across within the grid layout. For example, &lt;code&gt;data-grid-small=“6”&lt;/code&gt; defines that the item will span 6 columns for small viewports and above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-grid-medium=“”&lt;/code&gt; takes values 1 through 12. For example, &lt;code&gt;data-grid-medium=“4”&lt;/code&gt; defines that the item will span 4 columns for medium viewports and above.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-grid-large=“”&lt;/code&gt; takes values 1 through 12. For example, &lt;code&gt;data-grid-large=“8”&lt;/code&gt; defines that the item will span 8 columns for large viewports.&lt;/li&gt;
&lt;li&gt;
&lt;code&gt;data-grid-item-start=“”&lt;/code&gt; takes values 1 through 12. For example, &lt;code&gt;data-grid-item-start=“2”&lt;/code&gt; states that the item will start on the second column in the grid, giving the item an offset of 1. &lt;code&gt;data-grid-item-start=“1”&lt;/code&gt; will move an item to a new row if it is not the first item on an existing row.&lt;/li&gt;
&lt;li&gt;Note: please use caution when using &lt;code&gt;data-grid-item-start=“”&lt;/code&gt; to ensure that the grid layout does not create implicit columns beyond the desired 12 column layout. For example, using &lt;code&gt;data-grid-item-start=“8”&lt;/code&gt; in conjunction with &lt;code&gt;data-grid-large=“8”&lt;/code&gt; will cause 3 implicit columns to be generated (the item occupies columns 7–12, plus 3 implicit columns to accommodate a span of 8 columns, starting at column 7). This will disrupt the grid layout and cause misalignment per CSS Grid spec.&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  The Code
&lt;/h2&gt;

&lt;p&gt;The grid systems full code examples are available on CodePen (&lt;a href="https://codepen.io/team/DockYard/pen/pMrEzB" rel="noopener noreferrer"&gt;narwin-grid&lt;/a&gt;) as a boilerplate. This boilerplate will allow you to use the grid relative to your project by giving you the flexibility to set up breakpoints, gutters, and naming.&lt;/p&gt;

&lt;p&gt;Note: the following code examples use CSS nesting. At DockYard, we use PostCSS to handle the CSS processing to nest CSS.&lt;/p&gt;

&lt;h3&gt;
  
  
  CSS:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="cm"&gt;/* 12 column grid system */&lt;/span&gt;
&lt;span class="nc"&gt;.narwin-grid&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;display&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;grid&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="na"&gt;grid-template-columns&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nf"&gt;repeat&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="m"&gt;1fr&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

  &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;max-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;575px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;12px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;576px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-gap&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;24px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.narwin-grid__item&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="cm"&gt;/* Default layout when [data-grid-small] is not declared */&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nd"&gt;:not&lt;/span&gt;&lt;span class="o"&gt;([&lt;/span&gt;&lt;span class="nt"&gt;data-grid-small&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;12&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/* Data attributes that control the amount of columns an item will span within the 12 column layout for all viewports */&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-small&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-small&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-small&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"3"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;


  &lt;span class="cm"&gt;/* Data attributes that control the amount of columns an item will span within the 12 column layout for "medium" viewports and up */&lt;/span&gt;
  &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;576px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-medium&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-medium&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-medium&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"3"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/* Data attributes that control the amount of columns an item will span within the 12 column layout for "large" viewports and up */&lt;/span&gt;
  &lt;span class="k"&gt;@media&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;min-width&lt;/span&gt;&lt;span class="o"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1024px&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-large&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
    &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-large&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
      &lt;span class="na"&gt;grid-column-end&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;span&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;

  &lt;span class="cm"&gt;/* Grid item start values that position elements on the 12 column grid, this is just like setting an offset for grid items */&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-item-start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"1"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-item-start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"2"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;2&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;data-grid-item-start&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s2"&gt;"3"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="na"&gt;grid-column-start&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;


&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h3&gt;
  
  
  HTML Example:
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight html"&gt;&lt;code&gt;&lt;span class="nt"&gt;&amp;lt;form&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"narwin-grid"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"narwin-grid__item"&lt;/span&gt; &lt;span class="na"&gt;data-grid-small=&lt;/span&gt;&lt;span class="s"&gt;"4"&lt;/span&gt; &lt;span class="na"&gt;data-grid-medium=&lt;/span&gt;&lt;span class="s"&gt;"4"&lt;/span&gt; &lt;span class="na"&gt;data-grid-large=&lt;/span&gt;&lt;span class="s"&gt;"6"&lt;/span&gt; &lt;span class="na"&gt;data-grid-item-start=&lt;/span&gt;&lt;span class="s"&gt;"2"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    ...
  &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"narwin-grid__item"&lt;/span&gt; &lt;span class="na"&gt;data-grid-small=&lt;/span&gt;&lt;span class="s"&gt;"1"&lt;/span&gt; &lt;span class="na"&gt;data-grid-medium=&lt;/span&gt;&lt;span class="s"&gt;"7"&lt;/span&gt; &lt;span class="na"&gt;data-grid-large=&lt;/span&gt;&lt;span class="s"&gt;"5"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    ...
  &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;

  &lt;span class="nt"&gt;&amp;lt;fieldset&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"narwin-grid__item"&lt;/span&gt; &lt;span class="na"&gt;data-grid-small=&lt;/span&gt;&lt;span class="s"&gt;"3"&lt;/span&gt; &lt;span class="na"&gt;data-grid-medium=&lt;/span&gt;&lt;span class="s"&gt;"4"&lt;/span&gt; &lt;span class="na"&gt;data-grid-large=&lt;/span&gt;&lt;span class="s"&gt;"7"&lt;/span&gt; &lt;span class="na"&gt;data-grid-item-start=&lt;/span&gt;&lt;span class="s"&gt;"1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
    ...
  &lt;span class="nt"&gt;&amp;lt;/fieldset&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/form&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;a href="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwacmA6l.jpg" class="article-body-image-wrapper"&gt;&lt;img src="https://media.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fi.imgur.com%2FwacmA6l.jpg" alt="Grid example"&gt;&lt;/a&gt;&lt;br&gt;
&lt;em&gt;Visual example of the HTML example above on a medium 930px viewport&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Set up and use your own 12-column grid system with these easy-to-understand data attributes and class names! You won’t need complicated calculations, and there are no negative margins, and you have the added benefit of knowing that it’s built with future proof HTML/CSS specs at it's core.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;This post originally appeared on &lt;a href="https://dockyard.com/" rel="noopener noreferrer"&gt;DockYard&lt;/a&gt;, where I currently work as a Senior UX Developer. DockYard is a digital product agency offering exceptional strategy, design, full stack engineering, web app development, and custom software services, consulting, and training.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>html</category>
      <category>beginners</category>
      <category>webdev</category>
    </item>
  </channel>
</rss>
