<?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: Chris Coyier</title>
    <description>The latest articles on DEV Community by Chris Coyier (@chriscoyier).</description>
    <link>https://dev.to/chriscoyier</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%2F2545%2F5m0hKrUC.jpg</url>
      <title>DEV Community: Chris Coyier</title>
      <link>https://dev.to/chriscoyier</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/chriscoyier"/>
    <language>en</language>
    <item>
      <title>I'm Chris Coyier from CodePen, CSS-Tricks, and ShopTalk Show. Ask Me Anything!</title>
      <dc:creator>Chris Coyier</dc:creator>
      <pubDate>Fri, 15 Nov 2019 15:14:32 +0000</pubDate>
      <link>https://dev.to/chriscoyier/i-m-chris-coyier-from-codepen-css-tricks-and-shoptalk-show-ask-me-anything-f58</link>
      <guid>https://dev.to/chriscoyier/i-m-chris-coyier-from-codepen-css-tricks-and-shoptalk-show-ask-me-anything-f58</guid>
      <description>&lt;p&gt;Hello! Like the title says, I am the co-founder of &lt;a href="https://codepen.io/" rel="noopener noreferrer"&gt;CodePen&lt;/a&gt; (I have two fellow co-founders: &lt;a href="https://codepen.io/tsabat" rel="noopener noreferrer"&gt;Tim&lt;/a&gt; and &lt;a href="https://codepen.io/quezo" rel="noopener noreferrer"&gt;Alex&lt;/a&gt;), I am the (owner? creator? CEO? lol it's just a blog ok) of &lt;a href="https://css-tricks.com/" rel="noopener noreferrer"&gt;CSS-Tricks&lt;/a&gt;, and co-host of &lt;a href="https://shoptalkshow.com/" rel="noopener noreferrer"&gt;ShopTalk Show&lt;/a&gt; with &lt;a href="https://shoptalkshow.com/" rel="noopener noreferrer"&gt;Dave&lt;/a&gt;.&lt;/p&gt;

&lt;p&gt;I think websites are great. I &lt;a href="https://chriscoyier.net/" rel="noopener noreferrer"&gt;have a personal one&lt;/a&gt; in addition to the other sites I help run. I probably like yours.&lt;/p&gt;

&lt;p&gt;Nothing has been more fun and helpful over the years than writing stuff publicly. It helps me think. It starts conversations. It gets me invited to stuff. Heck, a sizeable chunk of my income comes from sponsorship and advertising which is largely in and around that writing.&lt;/p&gt;

&lt;p&gt;Every time I &lt;a href="https://twitter.com/chriscoyier" rel="noopener noreferrer"&gt;tweet&lt;/a&gt; I think, &lt;em&gt;aw snap&lt;/em&gt;, that would have been more useful as a blog post.&lt;/p&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%2Fres.cloudinary.com%2Fcss-tricks%2Fimage%2Fupload%2Fc_scale%2Cf_auto%2Cq_auto%2Cw_1542%2Fv1573766475%2FIMG_0665_gj3xdx.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%2Fres.cloudinary.com%2Fcss-tricks%2Fimage%2Fupload%2Fc_scale%2Cf_auto%2Cq_auto%2Cw_1542%2Fv1573766475%2FIMG_0665_gj3xdx.jpg" alt="img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I think of myself as a front-end developer because I mostly write code that is meant for the browser. I feel like I have a decent perspective on the trade, as I work on (and have worked on) lots of projects across lots of different stacks and at lots of different scales. There are good and bad ideas everywhere.&lt;/p&gt;

&lt;p&gt;Ask me anything!&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>csstricks</category>
      <category>shoptalkshow</category>
      <category>ama</category>
    </item>
    <item>
      <title>(Other) Projects you can do to Become a Front-End Master in 2020</title>
      <dc:creator>Chris Coyier</dc:creator>
      <pubDate>Fri, 11 Oct 2019 16:09:44 +0000</pubDate>
      <link>https://dev.to/chriscoyier/9-other-projects-you-can-do-to-become-a-front-end-master-in-2020-450l</link>
      <guid>https://dev.to/chriscoyier/9-other-projects-you-can-do-to-become-a-front-end-master-in-2020-450l</guid>
      <description>&lt;p&gt;I love &lt;a href="https://dev.to/simonholdorf/9-projects-you-can-do-to-become-a-frontend-master-in-2020-n2h"&gt;this post by Simon Holdorf&lt;/a&gt;. He's got some ideas for you to level up your skills as a front-end developer next year. Here they are:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Build a movie search app using React&lt;/li&gt;
&lt;li&gt;Build a chat app with Vue&lt;/li&gt;
&lt;li&gt;Build a weather app with Angular&lt;/li&gt;
&lt;li&gt;Build a to-do app with Svelte&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;... and 5 more like that.&lt;/p&gt;

&lt;p&gt;All good ideas. All &lt;em&gt;extremely&lt;/em&gt; JavaScript framework focused. &lt;/p&gt;

&lt;p&gt;I like the idea of thinking of being a front-end developer as being someone who is a browser person. You deal with &lt;em&gt;people&lt;/em&gt; who use some kind of client to use the web on some kind of device. That's the job.&lt;/p&gt;

&lt;p&gt;I love JavaScript frameworks, but knowing them isn't what makes you a good front-end developer. Being performance-focused and accessibility-focused, and thus user-focused is what makes you a front-end master, beyond executing the skills required to get the website built.&lt;/p&gt;

&lt;p&gt;In that vein, here's some more ideas.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Go find &lt;a href="https://dribbble.com/"&gt;a Dribbble shot&lt;/a&gt; that appeals to you. Re-build it in HTML and CSS in the cleanest and most accessible way you can.&lt;/li&gt;
&lt;li&gt;Find a component you can abstract in your codebase, and abstract it so you can re-use it efficiently. Consider accessibility as you do it. Could you make it more accessible while doing it such that the entire site benefits?&lt;/li&gt;
&lt;li&gt;Install the &lt;a href="https://addons.mozilla.org/en-US/firefox/addon/axe-devtools/"&gt;Axe accessibility plugin for DevTools&lt;/a&gt; and run it on an important site you control. Make changes to improve the accessibility as it suggests. &lt;/li&gt;
&lt;li&gt;Spin up a copy of &lt;a href="https://fractal.build/"&gt;Fractal&lt;/a&gt;. Check out how it can help you think about building front ends as components, even at the HTML/CSS level.&lt;/li&gt;
&lt;li&gt;Build a beautiful form in HTML/CSS that does something useful for you, like receive leads for freelance work. Learn &lt;a href="https://css-tricks.com/form-validation-part-1-constraint-validation-html/"&gt;all about form validation&lt;/a&gt; and see how much you can do in just HTML, then HTML plus some CSS, then with some vanilla JavaScript. Make the form work by using &lt;a href="https://serverless.css-tricks.com/services/forms"&gt;a small dedicated service&lt;/a&gt;.&lt;/li&gt;
&lt;li&gt;
&lt;a href="https://serverless.css-tricks.com/about/"&gt;Read a bit about Serverless&lt;/a&gt; and how it can extend your front-end developer skillset.&lt;/li&gt;
&lt;li&gt;Figure out how to implement an SVG icon system. So many sites these days need an icon set. &lt;a href="https://css-tricks.com/pretty-good-svg-icon-system/"&gt;Inlining SVG&lt;/a&gt; is a great simple solution, but how you can abstract that to be easy to work with for your workflow? How can it work with the framework you use? &lt;/li&gt;
&lt;/ul&gt;

</description>
      <category>webdev</category>
      <category>javascript</category>
      <category>css</category>
    </item>
    <item>
      <title>Learn About CSS Custom Properties Through Clever Uses of Them</title>
      <dc:creator>Chris Coyier</dc:creator>
      <pubDate>Wed, 30 Jan 2019 21:29:42 +0000</pubDate>
      <link>https://dev.to/chriscoyier/learn-about-css-custom-properties-through-clever-uses-of-them-2fjo</link>
      <guid>https://dev.to/chriscoyier/learn-about-css-custom-properties-through-clever-uses-of-them-2fjo</guid>
      <description>&lt;p&gt;One of the biggest use-cases for CSS custom properties is theming. Let's consider that for a second. Perhaps you'd set some variables at the highest level you can:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--column-bg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ae0001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--menu-bg-hover&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#680001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--active-item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#D3A625&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Anywhere else in the CSS, you use the variables */&lt;/span&gt;
&lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--menu-bg-hover&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;Then if you want to change the theme, you have the opportunity to do that &lt;em&gt;in one isolated place&lt;/em&gt;, which makes things tremendously easier to reason about. Here we'll allow a class change on that root element to change the variables. Anywhere those variables are used will instantly update.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nt"&gt;html&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--column-bg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ae0001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--menu-bg-hover&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#680001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--active-item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#D3A625&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="nt"&gt;html&lt;/span&gt;&lt;span class="nc"&gt;.alternate-theme&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--column-bg&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#680001&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--menu-bg-hover&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#BE0002&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="py"&gt;--active-item&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#00FFBA&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Anywhere else in the CSS, you use the variables */&lt;/span&gt;
&lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt; &lt;span class="nc"&gt;.menu&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--menu-bg-hover&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;Here's a wonderful use of theming by Stephanie Liu. It's a recreation of the Slack interface's theming capabilities&lt;/p&gt;

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

&lt;p&gt;Above, I showed how you might alter the values of CSS custom properties by changing a class, but JavaScript is capable of changing those variable values directly by selecting the element and passing a new value to it, like &lt;code&gt;el.style.setProperty("--custom-property", "new-value");&lt;/code&gt;, which is how Stephanie is doing it in this demo.&lt;/p&gt;

&lt;p&gt;Like any good theming, a user's choice should persist. Stephanie handles this in this demo by plopping the selections into &lt;code&gt;localStorage&lt;/code&gt;, so check out her JavaScript to see how she's doing that. &lt;/p&gt;

&lt;h2&gt;
  
  
  Adjusting Theme Colors
&lt;/h2&gt;

&lt;p&gt;Another consideration with CSS custom properties being in control of color themes is that sometimes you want a variation of a color, rather than having to pick a whole new second color. Like a button with the chosen color as a border, but a faded version for a background. &lt;/p&gt;

&lt;p&gt;In a post by Ben Szabo, &lt;a href="https://codepen.io/finnhvman/post/theming-with-css-variables-in-rgba" rel="noopener noreferrer"&gt;Theming with CSS variables in RGBA&lt;/a&gt;, he mentions you could use RGBa or HSLa to make those adjustments with opacity. &lt;/p&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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3hox8ilmhfreg936owgw.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%2Fthepracticaldev.s3.amazonaws.com%2Fi%2F3hox8ilmhfreg936owgw.jpg" alt="img"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;If the original color is in RGB or HSL to begin with, the opacity adjustment is easy:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nd"&gt;:root&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="py"&gt;--my-color-rgb&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;255&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; 
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.btn&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;border&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&lt;/span&gt; &lt;span class="nb"&gt;solid&lt;/span&gt; &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--my-color-rgb&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--my-color-rgb&lt;/span&gt;&lt;span class="p"&gt;),&lt;/span&gt; &lt;span class="m"&gt;0.5&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;I did a demo once where I laid a transparent black gradient over top the color to darken it, so it's not just lightening you can do but darkening as well:&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Ana Tudor showed us we can make drastic changes to styling with the flip of a CSS custom property toggle.
&lt;/h2&gt;

&lt;p&gt;She called it &lt;a href="https://css-tricks.com/dry-switching-with-css-variables-the-difference-of-one-declaration/" rel="noopener noreferrer"&gt;DRY switching&lt;/a&gt;. &lt;/p&gt;

&lt;p&gt;The trick is rooted in math and the power of &lt;code&gt;0&lt;/code&gt; and &lt;code&gt;1&lt;/code&gt;. With &lt;code&gt;calc()&lt;/code&gt;, we can multiple values by zero and one and either get nothing or the original value. We can use that base trick for colors, positions, transforms... all kinds of stuff to get hugely different results when that flip is switched.&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Interesting SVG hovers from Marius Niveri
&lt;/h2&gt;

&lt;p&gt;I like this concept in which normal colored SVG has it's color temporarily removed with CSS, moved to a custom property, and then re-applied on hover. Like progressive enhancement coloring!&lt;/p&gt;

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

&lt;h2&gt;
  
  
  Keith Clark combined them with conic gradients to make pie charts
&lt;/h2&gt;

&lt;p&gt;Pass the percentage in right from the markup:&lt;br&gt;
&lt;/p&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;div&lt;/span&gt; &lt;span class="na"&gt;class=&lt;/span&gt;&lt;span class="s"&gt;"pie pie--value"&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"--percent:65;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use that value in a conic-gradient to draw the pie chart.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="nc"&gt;.pie&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;conic-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
    &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3.6deg&lt;/span&gt;  &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--percent&lt;/span&gt;&lt;span class="p"&gt;)),&lt;/span&gt;
    &lt;span class="n"&gt;rgba&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;0&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="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;3.6deg&lt;/span&gt;  &lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--percent&lt;/span&gt;&lt;span class="p"&gt;))&lt;/span&gt;
  &lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="py"&gt;background-blend-mode&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;overlay&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt; &lt;span class="m"&gt;50%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-size&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;150%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt; &lt;span class="c"&gt;/* oversize bg image to prevent "underdraw" */&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3.75em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;3.75em&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;border-radius&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;50%&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;Keith's demo is fancied up:&lt;/p&gt;

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

&lt;p&gt;He's even got a bonus trick in there of using CSS counters to display the percentage value.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sérgio Gomes aspect ratio trick with custom properties
&lt;/h2&gt;

&lt;p&gt;What if you could tell an HTML element directly what aspect ratio you wanted it to be? That's documented here. You pass in a ratio directly from the a custom property on the element:&lt;br&gt;
&lt;/p&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;div&lt;/span&gt; &lt;span class="na"&gt;style=&lt;/span&gt;&lt;span class="s"&gt;"--aspect-ratio:16/9;"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then use that value to apply a perfectly sized psuedo element inside that pushes it to that size.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"--aspect-ratio"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nd"&gt;:first-child&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"--aspect-ratio"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nt"&gt;img&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;   &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;auto&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt; 
&lt;span class="k"&gt;@supports&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--custom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt;&lt;span class="n"&gt;property&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"--aspect-ratio"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;relative&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;style&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"--aspect-ratio"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt;&lt;span class="nd"&gt;::before&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;content&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="s1"&gt;""&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="nb"&gt;block&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;padding-bottom&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;calc&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;100%&lt;/span&gt; &lt;span class="p"&gt;/&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;var&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;--aspect-ratio&lt;/span&gt;&lt;span class="p"&gt;)));&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt;
  &lt;span class="o"&gt;[&lt;/span&gt;&lt;span class="nt"&gt;style&lt;/span&gt;&lt;span class="o"&gt;*=&lt;/span&gt;&lt;span class="s1"&gt;"--aspect-ratio"&lt;/span&gt;&lt;span class="o"&gt;]&lt;/span&gt; &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; &lt;span class="nd"&gt;:first-child&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;position&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;absolute&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;top&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;left&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="nl"&gt;height&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;100%&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;p&gt;Clever stuff.&lt;/p&gt;

</description>
      <category>codepen</category>
      <category>css</category>
      <category>customproperties</category>
    </item>
    <item>
      <title>Some Incredibly Clever Layout Pens from CodePen (with bonus twists)</title>
      <dc:creator>Chris Coyier</dc:creator>
      <pubDate>Thu, 10 Jan 2019 18:51:27 +0000</pubDate>
      <link>https://dev.to/chriscoyier/some-incredibly-clever-layout-pens-from-codepen-with-bonus-twists-34l1</link>
      <guid>https://dev.to/chriscoyier/some-incredibly-clever-layout-pens-from-codepen-with-bonus-twists-34l1</guid>
      <description>&lt;h2&gt;
  
  
  Nicolás J Engler's Bullet Journal
&lt;/h2&gt;

&lt;p&gt;CSS grid makes this calendar, a perfect simple use case! But the transforms giving different elements tilt really give it life.&lt;/p&gt;

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

&lt;p&gt;Love that markered-off cell look. Check it out, it's all CSS with a repeating gradient:&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;

&lt;span class="nc"&gt;.cell.x&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-image&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; 
    &lt;span class="n"&gt;repeating-linear-gradient&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;
      &lt;span class="m"&gt;-45deg&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
      &lt;span class="nb"&gt;transparent&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="nb"&gt;transparent&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; 
      &lt;span class="m"&gt;#e53a40&lt;/span&gt; &lt;span class="m"&gt;3px&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="m"&gt;#e53a40&lt;/span&gt; &lt;span class="m"&gt;6px&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;h2&gt;
  
  
  Erin E. Sullivan's Book Layout
&lt;/h2&gt;

&lt;p&gt;You might think you'd have to manually cut content into two different elements to make a side-by-side layout like this that maintains content flow. But nope! Erin is using &lt;a href="https://css-tricks.com/guide-responsive-friendly-css-columns/" rel="noopener noreferrer"&gt;CSS columns&lt;/a&gt; here so the browser does that splitting and flowing naturally.&lt;/p&gt;

&lt;p&gt;You might wanna pop over to &lt;a href="https://codepen.io/erinesullivan/full/gxdbzp" rel="noopener noreferrer"&gt;Full Page View&lt;/a&gt; to see this one:&lt;/p&gt;

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

&lt;p&gt;There is even more clever bits here with all the handwriting-inspired underlining, highlighting, and stet. It's a background data URL SVG that makes that underline happen!&lt;/p&gt;
&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight css"&gt;&lt;code&gt;

&lt;span class="nc"&gt;.open-book&lt;/span&gt; &lt;span class="nt"&gt;a&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nl"&gt;background&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="sx"&gt;url(data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0idXRmLTgiP…gsNDMuOCw0MzIuNCw0Ni41LDQzMC45LDQ5LjJ6Ii8+DQoJCTwvZz4NCgk8L2c+DQo8L3N2Zz4=)&lt;/span&gt; &lt;span class="nb"&gt;bottom&lt;/span&gt; &lt;span class="nb"&gt;repeat-x&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;h2&gt;
  
  
  Luke Jacksonn's Flexbox Masonry
&lt;/h2&gt;

&lt;p&gt;Beyond being flexible, flexbox can be set in multiple directions and can wrap. Smashing all those ideas together can yield interesting flexible layouts like this:&lt;/p&gt;

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

&lt;p&gt;The cool trick in this one is that those otherwise empty flex elements keep their aspect ratio sizes by having SVG elements inside where their viewBox dictates that ratio:&lt;/p&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;div&amp;gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"320px"&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 2 1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/svg&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;
&lt;span class="nt"&gt;&amp;lt;div&amp;gt;&amp;lt;svg&lt;/span&gt; &lt;span class="na"&gt;width=&lt;/span&gt;&lt;span class="s"&gt;"320px"&lt;/span&gt; &lt;span class="na"&gt;viewBox=&lt;/span&gt;&lt;span class="s"&gt;"0 0 1 1"&lt;/span&gt;&lt;span class="nt"&gt;&amp;gt;&amp;lt;/svg&amp;gt;&amp;lt;/div&amp;gt;&lt;/span&gt;


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

&lt;/div&gt;

&lt;p&gt;Usually Masonry deals with what look like staggered vertical columns, but the content goes generally left-to-right in the source order still. The Masonry library still does a great job of that:&lt;/p&gt;

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

&lt;h3&gt;
  
  
  Olivia's Makeup Palettes
&lt;/h3&gt;

&lt;p&gt;You know flexbox and grid can play together nicely right? Any grid cell could become a flex container. But it works the other way around too, a flex item could become a grid container! That's exactly what's happening here:&lt;/p&gt;

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

&lt;p&gt;The overall layout here is flexbox, but the individual colored sections (which cleverly open up with 3D transforms) have a grid layout underneath them. Plus, each one has a slightly different grid setup, which is a wonderful touch.&lt;/p&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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegrfnj7ad4qd6p82z4xf.png" 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%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Farticles%2Fegrfnj7ad4qd6p82z4xf.png" alt="grid"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Look around!
&lt;/h2&gt;

&lt;p&gt;I've messed around with trying to &lt;a href="https://codepen.io/chriscoyier/pen/mewZzy" rel="noopener noreferrer"&gt;replicate magazine layouts&lt;/a&gt; myself just for fun. There is &lt;a href="https://codepen.io/search/pens?q=layout&amp;amp;page=1&amp;amp;order=popularity&amp;amp;depth=everything&amp;amp;show_forks=on" rel="noopener noreferrer"&gt;lots to explore&lt;/a&gt;! &lt;/p&gt;

</description>
      <category>css</category>
      <category>layout</category>
      <category>flexbox</category>
      <category>grid</category>
    </item>
  </channel>
</rss>
