<?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: Alex Carpenter</title>
    <description>The latest articles on Forem by Alex Carpenter (@hybrid_alex).</description>
    <link>https://forem.com/hybrid_alex</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%2F49209%2Fc2ad48d2-b5de-496c-b07a-c9da0c24be52.jpg</url>
      <title>Forem: Alex Carpenter</title>
      <link>https://forem.com/hybrid_alex</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://forem.com/feed/hybrid_alex"/>
    <language>en</language>
    <item>
      <title>How to add gradient overlays to images with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Mon, 16 Mar 2020 16:31:06 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-add-gradient-overlays-to-images-with-css-ao7</link>
      <guid>https://forem.com/hybrid_alex/how-to-add-gradient-overlays-to-images-with-css-ao7</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/mT10ZJdlh9Y"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Learn how to add a gradient overlay to your images to create a nice modern effect.&lt;/p&gt;

&lt;p&gt;View the demo code &lt;a href="https://codepen.io/alexcarpenter/pen/RwPyoyE"&gt;https://codepen.io/alexcarpenter/pen/RwPyoyE&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to use the object-fit CSS property to scale images responsively</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Wed, 11 Mar 2020 21:15:30 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-use-the-object-fit-css-property-to-scale-images-responsively-32f7</link>
      <guid>https://forem.com/hybrid_alex/how-to-use-the-object-fit-css-property-to-scale-images-responsively-32f7</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/mLZjKBC3R34"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;View the demo code: &lt;a href="https://codepen.io/alexcarpenter/pen/YzXeEbV"&gt;https://codepen.io/alexcarpenter/pen/YzXeEbV&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;object-fit browser support: &lt;a href="https://caniuse.com/#search=object-fit"&gt;https://caniuse.com/#search=object-fit&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to create skewed backgrounds with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Tue, 25 Feb 2020 15:35:11 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-create-skewed-backgrounds-with-css-4p18</link>
      <guid>https://forem.com/hybrid_alex/how-to-create-skewed-backgrounds-with-css-4p18</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/HE4Wjz3WSis"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;View the demo code &lt;a href="https://codepen.io/alexcarpenter/pen/PoqWvKg"&gt;https://codepen.io/alexcarpenter/pen/PoqWvKg&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to create vertical text with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Thu, 20 Feb 2020 19:32:36 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-create-vertical-text-with-css-226j</link>
      <guid>https://forem.com/hybrid_alex/how-to-create-vertical-text-with-css-226j</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/x5Dx5zgDwnI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;How to use CSS writing modes to create vertical text within your websites.&lt;/p&gt;

&lt;p&gt;View the demo code &lt;a href="https://codepen.io/alexcarpenter/pen/rNVMdGE"&gt;https://codepen.io/alexcarpenter/pen/rNVMdGE&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to add a gradient to text with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Wed, 19 Feb 2020 14:42:32 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-add-a-gradient-to-text-with-css-21cc</link>
      <guid>https://forem.com/hybrid_alex/how-to-add-a-gradient-to-text-with-css-21cc</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/hXsJ0BuFh9I"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Make your text blocks stand out by adding a gradient to your text with CSS.&lt;/p&gt;

&lt;p&gt;View the demo code &lt;a href="https://codepen.io/alexcarpenter/pen/VwLjEYO"&gt;https://codepen.io/alexcarpenter/pen/VwLjEYO&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>howto</category>
    </item>
    <item>
      <title>Using a pseudo element to mimic a rgba value</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Thu, 06 Feb 2020 15:11:33 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/using-a-pseudo-element-to-mimic-a-rgba-value-1c0h</link>
      <guid>https://forem.com/hybrid_alex/using-a-pseudo-element-to-mimic-a-rgba-value-1c0h</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/qPRvEJr1LvI"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;How I used a pseudo element to mimic a rgba value for the pill component I use on my website.&lt;/p&gt;

&lt;p&gt;You can view the CSS code for my website &lt;a href="https://www.youtube.com/redirect?q=https%3A%2F%2Fgithub.com%2Falexcarpenter%2Falexcarpenter.me%2Fblob%2Fmaster%2Fsrc%2F_includes%2Fassets%2Fapp.css&amp;amp;redir_token=Bm9MP69uD5vVBu0QkRgd2Jgoi1Z8MTU4MTA4ODIyM0AxNTgxMDAxODIz&amp;amp;v=qPRvEJr1LvI&amp;amp;event=video_description"&gt;here&lt;/a&gt;.&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to make your own CSS media object pattern</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Tue, 04 Feb 2020 16:21:00 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-make-your-own-css-media-object-pattern-3ecb</link>
      <guid>https://forem.com/hybrid_alex/how-to-make-your-own-css-media-object-pattern-3ecb</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/8omyNs6s390"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Originally created by Nicole Sullivan &lt;a href="http://www.stubbornella.org/content/2010/06/25/the-media-object-saves-hundreds-of-lines-of-code/"&gt;back in 2010&lt;/a&gt;, the media object is a common web pattern that "could save you hundreds of lines of code".&lt;/p&gt;

&lt;p&gt;View the demo on &lt;a href="https://www.youtube.com/redirect?q=https%3A%2F%2Fcodepen.io%2Falexcarpenter%2Fpen%2FLYEwXRV%3Feditors%3D1101&amp;amp;redir_token=yxEs2hQwBqEvZKwC9vGu6y_af318MTU4MDkxOTUxNkAxNTgwODMzMTE2&amp;amp;v=8omyNs6s390&amp;amp;event=video_description"&gt;CodePen&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to style a select element with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Mon, 27 Jan 2020 20:56:09 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-style-a-select-element-with-css-45oc</link>
      <guid>https://forem.com/hybrid_alex/how-to-style-a-select-element-with-css-45oc</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/m9dNLMbCjkk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;View the &lt;a href="https://www.youtube.com/redirect?v=m9dNLMbCjkk&amp;amp;redir_token=eMH7fW1DLzfagrUm-gEqKDcWXRx8MTU4MDI0NDgzMUAxNTgwMTU4NDMx&amp;amp;event=video_description&amp;amp;q=https%3A%2F%2Fcodepen.io%2Falexcarpenter%2Fpen%2FzYxbgVX"&gt;demo on CodePen&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to create custom checkbox and radio inputs with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Thu, 16 Jan 2020 00:00:00 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-create-custom-checkbox-and-radio-inputs-with-css-1084</link>
      <guid>https://forem.com/hybrid_alex/how-to-create-custom-checkbox-and-radio-inputs-with-css-1084</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/54YeIQ7Eo_g"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;One major thing I forgot to outline in the screencast is ensuring there is a focused state applied to the custom indicator when the user has focused the input. The code provided below includes a focus state.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight css"&gt;&lt;code&gt;&lt;span class="o"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;checkbox&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="nt"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"checkbox"&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control__input visually-hidden"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control__indicator"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;Blue&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;

&lt;span class="o"&gt;&amp;lt;!&lt;/span&gt;&lt;span class="nt"&gt;--&lt;/span&gt; &lt;span class="nt"&gt;radio&lt;/span&gt; &lt;span class="nt"&gt;--&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;input&lt;/span&gt; &lt;span class="nt"&gt;type&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"radio"&lt;/span&gt; &lt;span class="nt"&gt;name&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"color"&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control__input visually-hidden"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="o"&gt;&amp;lt;&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt; &lt;span class="nt"&gt;class&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="s1"&gt;"control __indicator control__ indicator--radio"&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;span&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;
  &lt;span class="nt"&gt;Blue&lt;/span&gt;
&lt;span class="o"&gt;&amp;lt;/&lt;/span&gt;&lt;span class="nt"&gt;label&lt;/span&gt;&lt;span class="o"&gt;&amp;gt;&lt;/span&gt;


&lt;span class="nc"&gt;.control&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-flex&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;.control__indicator&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;margin-right&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;.25rem&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;.75rem&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;.75rem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#ccc&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;3px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.control__indicator--radio&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;span class="nc"&gt;.control&lt;/span&gt; &lt;span class="nt"&gt;__input&lt;/span&gt;&lt;span class="nd"&gt;:focus&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nc"&gt;.control__&lt;/span&gt; &lt;span class="nt"&gt;indicator&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;box-shadow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0.2rem&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;38&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt;&lt;span class="m"&gt;143&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;.5&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="nc"&gt;.control&lt;/span&gt; &lt;span class="nt"&gt;__input&lt;/span&gt;&lt;span class="nd"&gt;:checked&lt;/span&gt; &lt;span class="o"&gt;~&lt;/span&gt; &lt;span class="nc"&gt;.control__&lt;/span&gt; &lt;span class="nt"&gt;indicator&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;background-color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;#05f&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="sx"&gt;url('data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyNCIgaGVpZ2h0PSIyNCIgdmlld0JveD0iMCAwIDI0IDI0Ij4gIDxwYXRoIGQ9Ik0wIDBoMjR2MjRIMHoiIGZpbGw9Im5vbmUiLz4gIDxwYXRoIGZpbGw9IiNmZmYiIGQ9Ik0xOCA3bC0xLjQxLTEuNDEtNi4zNCA2LjM0IDEuNDEgMS40MUwxOCA3em00LjI0LTEuNDFMMTEuNjYgMTYuMTcgNy40OCAxMmwtMS40MSAxLjQxTDExLjY2IDE5bDEyLTEyLTEuNDItMS40MXpNLjQxIDEzLjQxTDYgMTlsMS40MS0xLjQxTDEuODMgMTIgLjQxIDEzLjQxeiIvPjwvc3ZnPg==')&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;80%&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="nb"&gt;center&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;background-repeat&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;no-repeat&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;

&lt;span class="c"&gt;/* Visually hide the browser input to ensure it is still focusable via keyboards */&lt;/span&gt;

&lt;span class="nc"&gt;.visually-hidden&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;0&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;clip&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="n"&gt;rect&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&lt;/span&gt; &lt;span class="m"&gt;0&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;1px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;margin&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;-1px&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;overflow&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;hidden&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;padding&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;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;width&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="m"&gt;1px&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;&lt;a href="https://codepen.io/alexcarpenter/pen/rNNbwqB"&gt;Here's a demo on CodePen&lt;/a&gt; that you can play with.&lt;/p&gt;

</description>
      <category>css</category>
    </item>
    <item>
      <title>How to create a sticky footer with CSS</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Wed, 15 Jan 2020 16:52:18 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/how-to-create-a-sticky-footer-with-css-53id</link>
      <guid>https://forem.com/hybrid_alex/how-to-create-a-sticky-footer-with-css-53id</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/524emUPHsN8"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;How to use flexbox and auto margins to create a sticky footer with CSS.&lt;/p&gt;

&lt;p&gt;Demo &lt;a href="https://codepen.io/alexcarpenter/pen/YzPvQWr"&gt;https://codepen.io/alexcarpenter/pen/YzPvQWr&lt;/a&gt;&lt;/p&gt;

</description>
      <category>css</category>
      <category>flexbox</category>
    </item>
    <item>
      <title>Consecutively return a random item from a JavaScript array</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Mon, 11 Mar 2019 15:03:29 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/consecutively-return-a-random-item-from-a-javascript-array-261g</link>
      <guid>https://forem.com/hybrid_alex/consecutively-return-a-random-item-from-a-javascript-array-261g</guid>
      <description>&lt;p&gt;&lt;em&gt;View this post on &lt;a href="https://alexcarpenter.me/posts/2019/03/random-item-array/"&gt;alexcarpenter.me&lt;/a&gt;&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;The other week I was working on a &lt;a href="https://github.com/alexcarpenter/standup-starter"&gt;side project&lt;/a&gt; where I needed to consecutively return a random item from an array via a button click.&lt;/p&gt;

&lt;p&gt;To do this, I first created a function that returns a random item from an array.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="nx"&gt;randomItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;floor&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nb"&gt;Math&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;random&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="o"&gt;*&lt;/span&gt; &lt;span class="nx"&gt;arr&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;length&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 problem with using only the &lt;code&gt;randomItem&lt;/code&gt; function here, is that it was not uncommon to return the same item twice in a row.&lt;/p&gt;

&lt;p&gt;To fix that issue, I made use of a &lt;code&gt;do...while&lt;/code&gt; loop to call the &lt;code&gt;randomItem&lt;/code&gt; function until it returned a result which is not equal to the previously selected item.&lt;/p&gt;

&lt;p&gt;So while &lt;code&gt;prevItem&lt;/code&gt; is equal to &lt;code&gt;currentItem&lt;/code&gt;, run the &lt;code&gt;randomItem&lt;/code&gt; function.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight javascript"&gt;&lt;code&gt;&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;fruit&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Apples&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Oranges&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;Pears&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;];&lt;/span&gt;

&lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;currentItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;randomItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;

&lt;span class="nx"&gt;btn&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nx"&gt;addEventListener&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="s1"&gt;click&lt;/span&gt;&lt;span class="dl"&gt;'&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="kd"&gt;function&lt;/span&gt; &lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="kd"&gt;var&lt;/span&gt; &lt;span class="nx"&gt;prevItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;currentItem&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="k"&gt;do&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="nx"&gt;currentItem&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="nx"&gt;randomItem&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;fruit&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
  &lt;span class="p"&gt;}&lt;/span&gt; &lt;span class="k"&gt;while&lt;/span&gt; &lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="nx"&gt;prevItem&lt;/span&gt; &lt;span class="o"&gt;===&lt;/span&gt; &lt;span class="nx"&gt;currentItem&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;span class="p"&gt;},&lt;/span&gt; &lt;span class="kc"&gt;false&lt;/span&gt;&lt;span class="p"&gt;);&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;



&lt;p&gt;Now when we click the button, we will never get the same item returned consecutively.&lt;/p&gt;

&lt;p&gt;Checkout the &lt;a href="https://codepen.io/alexcarpenter/pen/QoMKNv?editors=1011"&gt;demo&lt;/a&gt; and open the console to see it in action.&lt;/p&gt;

</description>
      <category>javascript</category>
    </item>
    <item>
      <title>Style your default global links without affecting your component links</title>
      <dc:creator>Alex Carpenter</dc:creator>
      <pubDate>Wed, 27 Feb 2019 14:59:32 +0000</pubDate>
      <link>https://forem.com/hybrid_alex/style-your-default-global-links-without-affecting-your-component-links-39a9</link>
      <guid>https://forem.com/hybrid_alex/style-your-default-global-links-without-affecting-your-component-links-39a9</guid>
      <description>&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/K5rmQXlIomk"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;This is a little trick I've recently been implementing on any new projects. Style your default global links &lt;em&gt;without&lt;/em&gt; affecting your component links.&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight"&gt;&lt;pre class="highlight scss"&gt;&lt;code&gt;&lt;span class="nt"&gt;a&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;class&lt;/span&gt;&lt;span class="o"&gt;])&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="nl"&gt;color&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="mh"&gt;#0055ff&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
  &lt;span class="nl"&gt;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;none&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;

  &lt;span class="k"&gt;&amp;amp;&lt;/span&gt;&lt;span class="nd"&gt;:hover&lt;/span&gt;&lt;span class="o"&gt;,&lt;/span&gt;
  &lt;span class="k"&gt;&amp;amp;&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;text-decoration&lt;/span&gt;&lt;span class="p"&gt;:&lt;/span&gt; &lt;span class="nb"&gt;underline&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;This helps prevent having to overwrite your global default link styles that you have applied within your component links.&lt;/p&gt;

&lt;p&gt;Check out the demo below:&lt;/p&gt;

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

</description>
      <category>css</category>
      <category>sass</category>
    </item>
  </channel>
</rss>
