aboutsummaryrefslogtreecommitdiff
path: root/build/stripe-menu-css/index.html
blob: 44d7ef3b6736b6f10a131d60ac75198e4cfc4cee (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
<!doctype html>
<html lang="en" id="top">
<head>
	<meta charset="utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<link rel="icon" href="data:,">
	<title>Stripe Menu Dropdowns (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>
</head>

<nav>
  <a href="#menu">Menu &darr;</a>
</nav>

<main>
<h1>Stripe Menu Dropdowns (CSS)</h1>
<p>2020-03-31</p>
<p>In a previous article I wrote, <a href="blog/minimal-css-menu">Minimal CSS: Dropdown Menus</a>, I showed how you could create a basic menu dropdown with only 121 bytes of CSS. While this demo is great for simple text-based menu dropdowns, it doesn't show just how complex (in a good way) you can make CSS-only menus. So, let's do just that.</p>
<h2>What we want to emulate</h2>
<p>I think, like most designers, that the UI and web design work from the <a href="https://stripe.com/">Stripe</a> team is pretty fantastic. Their clean approach using subtle animations and minimal elements make for a pleasant experience. Unfortunately, there is <i>one problem</i> with their current dropdown menus on their main website:</p>
<p><b>They don't work if JavaScript is disabled.</b></p>
<p>But we can easily fix that. So enough chit-chat, let's rip-off their menu design and recreate it with only CSS!</p>
<h3>Original (<a href="https://stripe.com">Stripe Website</a>)</h3>
<p><figure>
    <img src="/public/images/stripe-default-menu.webp" alt="Stripe default menu">
    <figcaption>Stripe's default menu dropdown (using both CSS & JavaScript) (<a href="/public/images/stripe-default-menu.webp">direct link to image</a>)</figcaption>
</figure></p>
<h3>Our recreation (<a href="https://codepen.io/bradleytaunt/full/ExjMjLL">CodePen Demo</a>)</h3>
<p><figure>
    <img src="/public/images/stripe-recreated.webp" alt="Stripe menu recreated">
    <figcaption>Our recreation with pure CSS (zero JavaScript) (<a href="/public/images/stripe-recreated.webp">direct link to image</a>)</figcaption>
</figure></p>
<p>Although our redesign is far from an exact replica (some subtle animations are missing which could always be added) - it's still impressive what you can do with some bare-bones CSS. Just something to keep in mind the next time you decide to reach for a JavaScript library to implement a similar design.</p>
<h2>See it live in action</h2>
<p>Load in the CodePen below and play around with the menu dropdown. Feel free to re-use, break. share or <i>steal</i> this for any and all purposes. Enjoy!</p>
<p><a href="https://codepen.io/bradleytaunt/pen/ExjMjLL">Live CodePen Example</a></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>