aboutsummaryrefslogtreecommitdiff
path: root/build/aui/index.html
blob: c897c3cdf79b96c76049c02f9002fcbf4bb92ffa (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
<!doctype html>
<html lang="en">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta name="color-scheme" content="dark light">
	<link rel="icon" href="data:,">
	<title>Aqua UI CSS Buttons</title>
	<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;}blockquote{background:rgba(0,0,0,0.1);border-left:4px solid;padding-left:5px;}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>
</nav>

<main>
<h1 id="aqua-ui-css-buttons">Aqua UI CSS Buttons</h1>
<p>2016-06-28</p>
<p>Though it may feel like nostalgia, the old OS design for Mac was arguably better than the current iteration (as of this writing - High Sierra). I recently designed a quick Dribbble shot showcasing how the older operating system used to have so much more character and depth.</p>
<p>Since I&#8217;ve been wanting to dip my toes into more tutorial-based articles (maybe I&#8217;ll even do some screencasts in the future), I decided to start out simple. Let&#8217;s walk through how to implement these &#8216;aqua&#8217; UI buttons with pure CSS.</p>
<h3 id="starting-with-a-basic-foundation">Starting with a basic foundation</h3>
<p>Since this project consists of only two buttons elements, the HTML or skeleton of this project is very straightforward:</p>
<pre><code>&#60;button class="cancel"&#62;Cancel&#60;&#47;button&#62;
&#60;button class="confirm"&#62;Confirm&#60;&#47;button&#62;
</code></pre>
<h3 id="styling-the-buttons">Styling the buttons</h3>
<p>The first step is to remove the browser&#8217;s default button styling by using the <code>appearance</code> property. This will help avoid having to fight against the browser and minimize our CSS code.</p>
<pre><code>button {
    -webkit-appearance: none;
    -moz-appearance: none;
}
</code></pre>
<p>Next, we apply a fairly simple set of CSS that will be shared across both the confirm and cancel buttons:</p>
<p>(Pay attention to the <code>transition</code> property as we will be returning to that shortly)</p>
<pre><code>button {
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid #ccc;
    border-radius: 125px;
    box-shadow: inset 0 13px 25px rgba(255,255,255,0.5), 0 3px 5px rgba(0,0,0,0.2), 0 10px 13px rgba(0,0,0,0.1);
    cursor: pointer;
    font-family: &#39;Lucida Grande&#39;, Helvetica, Arial, sans-serif;
    font-size: 2rem;
    margin: 5rem 1rem;
    padding: 1.2rem 4rem;
    position: relative;
    transition: all ease .3s;
}
</code></pre>
<p>Then we separate the specific confirm and cancel button styles into their own class selectors:</p>
<pre><code>button.confirm {
    background: #4A90E2;
    border-color: #3672B6;
    color: #fff;
}

button.cancel {
    background: #D0D0D0;
    border-color: #B8B8B8;
    color: #6F6F6F;
}
</code></pre>
<h3 id="playing-with-pseudo-elements">Playing with pseudo elements</h3>
<p>Now that the button is styled and structured with basic formatting, it&#8217;s time to add that classic &#8216;shine&#8217; seen in the original Dribbble shot.</p>
<p>The cleanest way to do this is by using the <code>:before</code> pseudo element paired with a linear-gradient background.</p>
<pre><code>button:before {
    background: linear-gradient(rgba(255,255,255,1) 0%, rgba(255,255,255,0) 100%);
    border-radius: 125px;
    content:&#39;&#39;;
    height: 50px;
    left: 4%;
    position: absolute;
    top: 1px;
    transition: all ease .3s;
    width: 92%;
}
</code></pre>
<h3 id="adding-interaction">Adding interaction</h3>
<p>The final step is adding the user hover interaction: (Remember that <code>transition</code> property?)</p>
<pre><code>button:hover {
    box-shadow: inset 0 13px 25px rgba(255,255,255,0.8), 0 3px 5px rgba(0,0,0,0.2), 0 10px 13px rgba(0,0,0,0.2);
    transform: scale(1.02);
}
</code></pre>
<p>That&#8217;s it!</p>
<h3 id="see-it-live-on-codepen">See it live on CodePen</h3>
<p>You can view this project on CodePen here.</p>
<p>Feel free to fork it or implement your own!</p>
<footer role="contentinfo">
    <h2>Menu Navigation</h2>
    <ul id="menu">
        <li><a href="/">Home</a></li>
        <li><a href="/projects">Projects</a></li>
        <li><a href="/uses">Uses</a></li>
        <li><a href="/wiki">Wiki</a></li>
        <li><a href="/resume">Resume</a></li>
        <li><a href="/colophon">Colophon</a></li>
        <li><a href="/now">Now</a></li>
        <li><a href="/donate">Donate</a></li>
        <li><a href="/atom.xml">RSS</a></li>
        <li><a href="#top">&uarr; Top of the page</a></li>
    </ul>
    <small>
        Built with <a href="https://git.sr.ht/~bt/barf">barf</a>. <br>
        Maintained with ♥ for the web. <br>
        Proud supporter of <a href="https://usefathom.com/ref/DKHJVX">Fathom</a> &amp; <a href="https://nextdns.io/?from=74d3p3h8">NextDNS</a>. <br>
        The content for this site is <a href="https://creativecommons.org/licenses/by-sa/2.0/">CC-BY-SA</a>.<br> The <a href="https://git.sr.ht/~bt/bt.ht">code for this site</a> is <a href="https://git.sr.ht/~bt/bt.ht/tree/master/item/LICENSE">MIT</a>.
    </small>
</footer>