Skip to content

Commit 1796211

Browse files
committed
devPunk Pure CSS Tabs (Inspired by Vicente)
- based on https://gist.github.com/snuggs/d10c14af11c7ee3070e47168fa9bc0bb
1 parent c6c5dc8 commit 1796211

File tree

1 file changed

+96
-0
lines changed

1 file changed

+96
-0
lines changed

public/tabs.html

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
<!-- This will degrade gracefully back to like IE6 Anchors or something ancient -->
2+
3+
<meta charset='utf-8'>
4+
<meta name='viewport' content='width=device-width, initial-scale=1.0'>
5+
6+
<title>#devPunk Pure CSS Tabs</title>
7+
8+
<style>
9+
@import '//www.devpunks.com/typography.css';
10+
11+
:root {
12+
--lightest-color: rgba(255,255,255,0.9);
13+
--lighter-color: rgba(245,245,245,0.8);
14+
--darker-color: rgba(100,100,100, 0.8);
15+
}
16+
17+
body {
18+
display: flex;
19+
flex-direction: column;
20+
padding-bottom: 0; // this is just to override typography.css setting
21+
}
22+
23+
h1 { text-align: center }
24+
section h1 { color: var(--darker-color) }
25+
26+
menu {
27+
margin: 0;
28+
height: 3em;
29+
display: flex;
30+
flex-direction: row;
31+
align-items: flex-end;
32+
justify-content: center;
33+
background: var(--darker-color);
34+
}
35+
menu a {
36+
border-bottom: 0;
37+
padding: 0.5em 1em;
38+
margin: 0.5em 0.5em 0;
39+
color: var(--darker-color);
40+
background: var(--lighter-color);
41+
}
42+
menu a:hover { background: var(--lightest-color) }
43+
44+
/*
45+
targeted selectors (allows fragment identifier to be used for bookmarks
46+
https://en.wikipedia.org/wiki/Fragment_identifier
47+
https://developer.mozilla.org/en-US/docs/Web/CSS/:target
48+
49+
*/
50+
#about, #maintenance, #calibration { display: none }
51+
#about:target, #maintenance:target, #calibration:target
52+
{
53+
flex: 1;
54+
margin: 0;
55+
display: block;
56+
color: var(--darker-color);
57+
background: var(--lightest-color);
58+
59+
// General sibling selectors
60+
// https://developer.mozilla.org/en-US/docs/Web/CSS/General_sibling_selectors
61+
}
62+
p { text-align: center; margin: var(--margin) }
63+
</style>
64+
65+
<h1>#devPunk Pure CSS Tabs</h1>
66+
67+
<!-- https://developer.mozilla.org/en-US/docs/Web/HTML/Element/menu -->
68+
69+
<p>
70+
<strong>BEHOLD</strong> Pure CSS Tabs 😂
71+
<a title='Get the gist' rel='external' target='github' href='https://gist.github.com/snuggs/d10c14af11c7ee3070e47168fa9bc0bb'>Get the gist</a>
72+
</p>
73+
74+
<menu>
75+
<a title='About' href='#about'>About</a>
76+
<a title='Maintenance' href='#maintenance'>Maintenance</a>
77+
<a title='Calibration' href='#calibration'>Calibration</a>
78+
</menu>
79+
80+
<section id='about'>
81+
<h1>About</h1>
82+
83+
<p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit. Donec odio. Quisque volutpat mattis eros.
84+
</section>
85+
86+
<section id='maintenance'>
87+
<h1>Maintenance</h1>
88+
89+
<p>Donec nec justo eget felis facilisis fermentum. Aliquam porttitor mauris sit amet orci. Aenean dignissim pellentesque felis.
90+
</section>
91+
92+
<section id='calibration'>
93+
<h1>Calibratoin</h1>
94+
95+
<p>Morbi in sem quis dui placerat ornare. Pellentesque odio nisi, euismod in, pharetra a, ultricies in, diam. Sed arcu. Cras consequat.
96+
</section>

0 commit comments

Comments
 (0)