aboutsummaryrefslogtreecommitdiff
path: root/build/macos-icon-css/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'build/macos-icon-css/index.html')
-rw-r--r--build/macos-icon-css/index.html181
1 files changed, 105 insertions, 76 deletions
diff --git a/build/macos-icon-css/index.html b/build/macos-icon-css/index.html
index bed4d4b..2a7d39b 100644
--- a/build/macos-icon-css/index.html
+++ b/build/macos-icon-css/index.html
@@ -1,88 +1,99 @@
<!doctype html>
-<html lang="en" id="top">
+<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="icon" href="data:,">
<title>Create a Mac App Icon with Pure HTML and CSS</title>
- <link href="https://bt.ht/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
- <style>*{box-sizing:border-box;}body{font-family:sans-serif;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{overflow:auto;}table{text-align:left;width:100%;}</style>
+ <link href="/atom.xml" type="application/atom+xml" rel="alternate" title="Atom feed for blog posts" />
+ <link href="/rss.xml" type="application/rss+xml" rel="alternate" title="RSS feed for blog posts" />
+<style>*{box-sizing:border-box;}body{font-family:sans-serif;line-height:1.33;margin:0 auto;max-width:650px;padding:1rem;}img{max-width:100%;}pre{border:1px solid;overflow:auto;padding:5px;}table{text-align:left;width:100%;}.footnotes{font-size:90%;}</style>
</head>
<nav>
- <a href="#menu">Menu &darr;</a>
+ <a href="#menu">Menu &darr;</a>
</nav>
<main>
-<h1>Create a Mac App Icon with Pure HTML and CSS</h1>
+<h1 id="create-a-mac-app-icon-with-pure-html-and-css">Create a Mac App Icon with Pure HTML and CSS</h1>
+
<p>2021-04-13</p>
-<p>I have always been a huge fan of <a href="https://dribbble.com/bg-d">Bogdan's work on Dribbble</a> and was recently inspired to see if I could replicate one of his awesome icon designs with only HTML &amp; CSS. What was the outcome? I think it's a half-way decent copy - of course the original will always look significantly better.</p>
-<p>Don't care about reading through the tutorial? No problem! You can <a href="#demo">jump right down to the live demo</a></p>
-<h2>The Comparison</h2>
-<p>Let's take a look at the original Dribbble shot:</p>
-<p><figure>
- <img src="/public/images/e54ac9b2850f786471d7790bec3844a6.webp" alt="Big Sur Icon">
- <figcaption>The original Dribbble shot (<a href="/public/images/e54ac9b2850f786471d7790bec3844a6.webp">direct link to image</a>)</figcaption>
-</figure></p>
-<p>And now let's see what we will be creating with only HTML &amp; CSS:</p>
-<p><figure>
- <img src="/public/images/big-sur-css.webp" alt="Big Sur Icon">
- <figcaption>What we are going to create with pure HTML &amp; CSS (<a href="/public/images/big-sur-css.webp">direct link to image</a>)</figcaption>
-</figure></p>
+
+<p>I have always been a huge fan of <a href="https://dribbble.com/bg-d">Bogdan&#8217;s work on Dribbble</a> and was recently inspired to see if I could replicate one of his awesome icon designs with only HTML &#38; CSS. What was the outcome? I think it&#8217;s a half-way decent copy - of course the original will always look significantly better.</p>
+
+<p>Don&#8217;t care about reading through the tutorial? No problem! You can <a href="#demo">jump right down to the live demo</a></p>
+
+<h2 id="the-comparison">The Comparison</h2>
+
+<p>Let&#8217;s take a look at the original Dribbble shot:</p>
+
+<p>And now let&#8217;s see what we will be creating with only HTML &#38; CSS:</p>
+
<p>Like I said - far from perfect but still a fun experiment!</p>
-<h2>The HTML</h2>
-<p>Let's jump right in and build out the main skeleton of our project:</p>
-<pre><code>&lt;div class=&quot;white-square&quot;&gt;&lt;/div&gt;
-&lt;div class=&quot;blue-square&quot;&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
- &lt;div class=&quot;row&quot;&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;div class=&quot;item&quot;&gt;&lt;/div&gt;
- &lt;/div&gt;
-&lt;/div&gt;
-&lt;div class=&quot;play-button&quot;&gt;
- &lt;div class=&quot;triangle&quot;&gt;&lt;/div&gt;
-&lt;/div&gt;
+
+<h2 id="the-html">The HTML</h2>
+
+<p>Let&#8217;s jump right in and build out the main skeleton of our project:</p>
+
+<pre><code>&#60;div class="white-square"&#62;&#60;&#47;div&#62;
+&#60;div class="blue-square"&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+ &#60;div class="row"&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;div class="item"&#62;&#60;&#47;div&#62;
+ &#60;&#47;div&#62;
+&#60;&#47;div&#62;
+&#60;div class="play-button"&#62;
+ &#60;div class="triangle"&#62;&#60;&#47;div&#62;
+&#60;&#47;div&#62;
</code></pre>
-<p> - The <code>white-square</code> element is the white, rounded square in the background
- - The <code>blue-square</code> is the main blue square of the icon
- - The <code>row</code> elements inside the <code>blue-square</code> will be our individual <em>lines</em> spread across the icon
- - The <code>play-button</code> is obviously - the play button</p>
-<p> Right now it will look like nothing, but we can change that by adding the most important part...</p>
-<h2>The CSS</h2>
-<p>Pasting the entire CSS styling here would end up looking a little daunting. Instead, I'm just going to breakdown each individual section to make things more digestible.</p>
-<h3>Defaults &amp; the White Square</h3>
+
+<ul>
+<li><p>The <code>white-square</code> element is the white, rounded square in the background</p></li>
+<li><p>The <code>blue-square</code> is the main blue square of the icon</p></li>
+<li><p>The <code>row</code> elements inside the <code>blue-square</code> will be our individual <em>lines</em> spread across the icon</p></li>
+<li><p>The <code>play-button</code> is obviously - the play button</p>
+
+<p>Right now it will look like nothing, but we can change that by adding the most important part&#8230;</p></li>
+</ul>
+
+<h2 id="the-css">The CSS</h2>
+
+<p>Pasting the entire CSS styling here would end up looking a little daunting. Instead, I&#8217;m just going to breakdown each individual section to make things more digestible.</p>
+
+<h3 id="defaults-the-white-square">Defaults &#38; the White Square</h3>
+
<pre><code>* {
box-sizing: border-box;
}
:root {
--row-distance: 42px;
}
-</code></pre>
-<pre><code>.white-square {
+
+.white-square {
background: white;
border-radius: 105px;
box-shadow: inset 0 -5px 8px rgba(0,0,0,0.25), 0 12px 10px rgba(0,0,0,0.15), 0 2px 4px rgba(0,0,0,0.1);
@@ -94,7 +105,9 @@
width: 420px;
}
</code></pre>
+
<p>See that <code>--row-distance</code> variable? That will come into play a bit later. For now, we want to lay the Blue Square on top of this newly creating White Square:</p>
+
<pre><code>.blue-square {
background: linear-gradient(#04BDFD 0%, #0585E4 100%);
border-radius: 105px;
@@ -107,8 +120,11 @@
width: 420px;
}
</code></pre>
-<h2>Targeting the Inner Rows</h2>
-<p>So far so good. The next part <em>looks</em> like a lot, but I assure you it's fairly straightforward. We need to include each row inside the Blue Square like in the original Dribbble shot (7 total). First we start with the parent <code>row</code> styling:</p>
+
+<h2 id="targeting-the-inner-rows">Targeting the Inner Rows</h2>
+
+<p>So far so good. The next part <em>looks</em> like a lot, but I assure you it&#8217;s fairly straightforward. We need to include each row inside the Blue Square like in the original Dribbble shot (7 total). First we start with the parent <code>row</code> styling:</p>
+
<pre><code>.blue-square .row {
display: flex;
height: 20px;
@@ -118,7 +134,9 @@
width: 100%;
}
</code></pre>
+
<p>Now we style each individual row item via the <code>nth-of-type</code> attribute:</p>
+
<pre><code>.blue-square .row:nth-of-type(2) { margin-top: var(--row-distance); }
.blue-square .row:nth-of-type(2) .item:nth-of-type(odd) {
width: 85px;
@@ -172,9 +190,13 @@
width: calc(100% - 55px);
}
</code></pre>
-<p>Take a few moments to read everything over - it will help you better understand what's going on. Basically, we are adding two inner elements to each row element. We calculate the <code>margin-top</code> distance by using that <code>--row-distance</code> variable I mentioned earlier. The inner elements are then styled based on their placement inside the row (<code>nth-of-type</code>).</p>
-<h3>The Play Button</h3>
+
+<p>Take a few moments to read everything over - it will help you better understand what&#8217;s going on. Basically, we are adding two inner elements to each row element. We calculate the <code>margin-top</code> distance by using that <code>--row-distance</code> variable I mentioned earlier. The inner elements are then styled based on their placement inside the row (<code>nth-of-type</code>).</p>
+
+<h3 id="the-play-button">The Play Button</h3>
+
<p>Now we finish things off with a much simpler element to style:</p>
+
<pre><code>.play-button {
backdrop-filter: blur(6px);
border-radius: 9999px;
@@ -189,7 +211,7 @@
.play-button::before {
background: rgba(255,255,255,0.9);
border-radius: 9999px;
- content:'';
+ content:&#39;&#39;;
filter: blur(40px);
height: 150%;
left: -25%;
@@ -208,7 +230,7 @@
}
.triangle:before,
.triangle:after {
- content: '';
+ content: &#39;&#39;;
position: absolute;
background-color: inherit;
}
@@ -230,17 +252,24 @@
transform: rotate(135deg) skewY(-45deg) scale(.707,1.414) translate(50%);
}
</code></pre>
-<p>Thanks to <a href="https://m.nintendojo.fr/@meduz/106059826445460903">meduz</a> for pointing out the <code>backdrop-filter</code> property. This allows for a frosted glass look on Chromium &amp; Safari (although sadly not on Firefox). The <code>triangle</code> element could also be improved by using an embedded <code>SVG</code> but I was determined to use only CSS for this experiment :P</p>
-<p>That's really all there is to it! You can see the embedded CodePen example below or <a href="https://codepen.io/bradleytaunt/pen/bGgBRaV">check it out directly here &amp;rarr;</a></p>
-<hr />
-<h3>Special Thanks</h3>
+
+<p>Thanks to <a href="https://m.nintendojo.fr/@meduz/106059826445460903">meduz</a> for pointing out the <code>backdrop-filter</code> property. This allows for a frosted glass look on Chromium &#38; Safari (although sadly not on Firefox). The <code>triangle</code> element could also be improved by using an embedded <code>SVG</code> but I was determined to use only CSS for this experiment :P</p>
+
+<p>That&#8217;s really all there is to it! You can see the embedded CodePen example below or <a href="https://codepen.io/bradleytaunt/pen/bGgBRaV">check it out directly here &#8594;</a></p>
+
+<hr/>
+
+<h3 id="special-thanks">Special Thanks</h3>
+
<p>Thanks to Bogdan for letting me butcher the original Dribbble shot :D</p>
+
<ul>
<li><a href="http://bg-d.net/">bg-d.net</a></li>
<li><a href="https://dribbble.com/bg-d">Bogdan on Dribbble</a></li>
</ul>
-<hr />
-<p><h2 id="demo">Live Demo (CodePen)</h2></p>
+
+<hr/>
+
<p><a href="https://codepen.io/bradleytaunt/pen/bGgBRaV">Live CodePen Demo</a></p>
<footer role="contentinfo">
<h2>Menu Navigation</h2>